Skip to content

Server rendering dynamic routes #2036

@Cap32

Description

@Cap32

I use server side rendering with some code splitting routes. It looks like OK on my server side with shim require.ensure. But I get the following warning on my client side:

Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
 (client) ctid=".bqth22sav4"><noscript data-reacti
 (server) ctid=".bqth22sav4"><div data-reactid=

Here is the main part of my client side codes:

const store = createStore(getInitialState());
const history = createHistory();
const { pathname, search } = window.location;
const location = createLocation(pathname + search);

match({ routes, location }, (err, redirectLocation, renderProps) => {
    render(
        <Provider store={store}>
            <Router
                {...renderProps}
                history={history}
            />
        </Provider>,
        document.getElementById('mount')
    );
});

Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestUsed to close PRs that haven't gone through/been accepted the Proposal process yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions