New course! Every coder should learn Generative AI!
Try a free lesson0
Inside your render method and before your return statement, you can declare variables you will need inside your component. This is the perfect place for destructuring your props or your state for instance.
https://dev.to/arnas/destructuring-react-props-for-the-cleaner-code-293
The return statement is mandatory because when the render method is called, it needs to return one of the following types : React Elements, Strings and numbers, Portals or Booleans.
Check the official documentation for more details :
https://reactjs.org/docs/react-component.html#render