Can react useContext pass value from peer component to peer component(in different file)?

Viewed 16

I only see examples of using useContext to pass values between parent and child components. I want to know if useContext can pass values between sibling components, which come from different files.

1 Answers

You can define context on parent component and then use it in its 2 childs respectively siblings.

You can also use Redux for this

Related