Passing context as props

At my workplace, inside the parent component file, a context is created and then <MyContext.Provider value={value}> will wrap the component it will pass into later.

But in the child I see that the original MyContext assignment in the parent, is directly imported from the Parent component file.

I thought the context could be accessed from props at any level. can someone explain why a direct context import AND provider component wrapping is needed?

1 Like

It can, but you still need to actually get it, it doesn’t just magically appear. You would need to show an example, as it’s difficult to ok now exactly what you’re trying to describe here.