I have to send values as true or false to another component in react.
so in my A component I am writing.
<Name.Provider value={true}>
</Name.Provider>
and in my B component I am writing
<Name.Consumer>
{
value =>
<span className="badge badge-white">
{value && <Link to="user"> List of Users</Link>}
</span>
}
</Name.Consumer>
since I am passing true to B, it should display the List of Users , but it is not displaying.
could you please tell me what wrong I am doing?
You need to provide that value to the link, I don't see in your code where are you providing that value, but you can have a look at this blog posts:
https://kentcdodds.com/blog/how-to-use-react-context-effectively
https://dmitripavlutin.com/react-context-and-usecontext/