Answer the question
In order to leave comments, you need to log in
How to define a local variable in another react file?
I have to use the Abc variable from a.tsx to another b.tsx file. How can I access this Abc variable in another .tsx file?
Current a.tsx:
export const ProfilePicEditor = (props: ProfilePicEditorProps) => {
const [Abc, setAbc] = useState(
'some string'
)
Answer the question
In order to leave comments, you need to log in
Lifting state up
Either use the state management library. For example, Redux or MobX.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question