P
P
picka2021-05-23 20:03:21
React
picka, 2021-05-23 20:03:21

How to perform an action in Redux using Next.js on the server side?

How to perform this action on the server side:

export const getItems = () => {
    return dispatch => {
        fetch('http://localhost:1337/global')
            .then(res => res.json())
            .then(data => dispatch({ type: GET_ITEMS, payload: data }))
            .catch(err => console.error(err))
    }
}


In this code I am getting the global app settings from cms, how would it be better to implement this in a Next.js app using Redux?
In nuxt.js for vue.js there is nuxtServerInit, is there an analogue in next

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question