React - Redux - Server Side rendering not rendering when the api url is dynamic

66 Views Asked by At

I am using react Server side rendering, when my api url is static, i get a response and my server side rendering works but when there is a valid(dynamic) parameter in my api url, i get a api response but the page will not inject the response to the server to render whole html.(it just perform a client side rendering)

my action - file

export const FETCH_CONTENT = 'fetch_content';
export const fetchContent = (slug) => async(dispatch, getState, api) => {
    const res = await api.get(`/static-pages/${slug}`);// when i use this it loads client side rendering
    //const res = await api.get(`/static-pages/terms-and-condition`); // when i use this url server side rendering works

    dispatch({
        type: FETCH_CONTENT,
        payload:res
    });

};
0

There are 0 best solutions below