I was trying to get my state with useSelector and when I console.log it I get my data perfectly but when I try to put that data in useState my value stays empty this is my code :
const settings = useSelector((state) => state.getsettings);
console.log("SETTINGS ==>", settings.info);``
const [getValue, setValue] = useState(settings.info.fulfilmentAutoma);
my "getValue" is empty while my "settings.info.fulfilmentAuto" is not!
any help please ?!
you should use useEffect
:
useEffect(()=>{
setValue(settings.info.fulfilmentAutoma);
});