I have two .js files wherein I am defining two different components: A.js and B.js. I have a constant named value
defined in B.js which uses the UseState hook, so when I try to import B
into A.js I want to access one constant defined in B.js. Here's my code for a better clarity.
B.js
import clickcomponent from ".../..xxx"
export default function B(){
...
...
const[value, setvalue]= useState("");
...
...
return(
<clickcomponent
...
...
onClick={newValue => {
setvalue(newValue ? newValue : []);
}}
/>
);
}
A.js
import B from "B.js"
export default function A(){
...
...
return (
<B/>
);
}
I want to access the value of const value
defined in B.js in A.js. How to achieve that?