No, If we use HOC inside the render method then it will affect the app's performance since the identity of HOC will not be preserved in this case.
Also due to this, remounting a component will result in remounting of all the children component. So HOC should be defined outside the component, ensuring that the component is created only once.
React’s diffing algorithm (called Reconciliation) uses component identity to determine whether it should update the existing subtree or throw it away and mount a new one. If the component returned from render is identical (===) to the component from the previous render, React recursively updates the subtree by diffing it with the new one. If they’re not equal, the previous subtree is unmounted completely.