The following is a piece of code which works fine, but somehow it looks a bit odd to me to have a function inside a render method and use it in both conditions. Let me know how can I improve this react code as showContainer is only adding a wrapper to the function JSX.
Code -
render () {
const childJsx = () => (<><h3>Random Child JSX</h3></>)
return (
<>
{ showContainer ?
<Modal>
{childJsx()}
</Modal>
:
<div className="parent">
{childJsx()}
</div>
}
</>
)
}