Sometimes I meet in code of other people constructions that look like this:
const TextField = () => {
const renderLabel = () => {..}
const renderInput = () => {...}
const renderFooter = () => {...}
return (
<div>
{
renderLabel();
renderInput();
renderFooter();
}
</div>
)
}
I understand why they use this way, cause it's can be situation when "return" is too small to split it to separate components and at the same time I want it to look more comfortable to udnerstand.
But only one questions here, why everywhere people use functions for these "renderLabel", "renderInput" and so on?
What cons of the way when I just create them as variables const renderLabel = <div>...</div>
and then render it?