Answer the question
In order to leave comments, you need to log in
How to combine next.js and redux?
Next.js has a getServerSideProps function that can return data from the server as props to the component.
But what if I need this data not only in the component, but also in redux?
export default function RoomsPage({dataUsers}) {
const dispatch = useDispatch()
React.useEffect(() => {
dispatch(userActions.setUser(dataUsers))
}, [dataUsers])
const users = useSelector((state: any) => state?.users)
.....
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question