an api by axios.
I set fetched data into a state named movies like :
const [movies,setMovies]=useState()
useEffect(()=>{
movieData.then(data=>setMovies(data))
},[movies])
and pass movies to initialState like :
const initialState = {
movieData:movies
}
This way i pass initialState to reducer:
const [state, dispatch] = useReducer(appReducer, initialState);
matter is the state of reducer does not contain data while setMovies works and gets data.
can you help me with this please? I share any more deta
I'd need to see the whole component/reducers/ etc
Обсуждают сегодня