I am currently reading React official website, where I came across this question. React official website states that we can use function code inside JSX. Hence, I tried the following code, but it's not working.
class ABCD extends React.Component {
render() {
return (
<div>
<p>
{() => <div>Hello World </div>}
</p>
</div>
);
}
}
I know, I know, some of you might say see the example given on the React website. I saw it, the example given on the official website involves outside function. I just want to know that can we use function inside JSX independently.
See this link for extra info: https://reactjs.org/docs/jsx-in-depth.html