score:14

Accepted answer
<div>
   {RenderImages()}
</div>

As you have called RenderImages as a function and it's confused as there is a Hook usage. If you used it like this it'll work as use it includes RenderImages as a Functional Component.

<div>
   <RenderImages />
</div>

score:3

https://reactjs.org/docs/hooks-rules.html

Don’t call Hooks inside loops, conditions, or nested functions. Instead, always use Hooks at the top level of your React function.


Related Query

More Query from same tag