I want to extract an object from redux. I want to display the value when it is loaded. I don't know how to do it.
const user = useSelector((state) => state.user);
This is the code I wrote. It extracts the value from redux but initially, it is undefined. I want to perform a function when the value gets loaded completely. How can I do it?
You can do it by using conditional rendering for example:
const user = useSelector((state) => state.user);
{user && user.map(item=>(
<div>
<ul>
<li>{item.name}</li>
<ul>
</div>
)}
so if user is true then only map the user array, try this code in your render method of JSX.