I am confused about scope in react.
const global = "Hey i am in global scope";
const component = () => {
return <p>{global}</p>
}
Is it lexical?
I am confused about scope in react.
const global = "Hey i am in global scope";
const component = () => {
return <p>{global}</p>
}
Is it lexical?
React is a JavaScript library. The example you've mentioned is of lexical scope. It follows all principles of JavaScript. You can get more on scoping in the below links: