DEV Community

Discussion on: Avoid Prop Drilling In React With Context API

Collapse
 
slowwie profile image
Michael

So I have to create a new file context.js and import it? Or how can I import it into the childcomponents when I don't have a seperate file?

Collapse
 
hadeel_salah profile image
Hadeel Salah

"The context can be initialized in the top parent components, or in the separate file; it doesn't matter. It can be imported or exported."