React-router: Server Side Redering | RouterContext and match alternatives in react-router-dom

Created on 20 Apr 2017  路  1Comment  路  Source: ReactTraining/react-router

Hi,

Any alternative for RouterContext and match in react-router-dom?

I need to do something like below in express:

app.get('*', (req, res) => {

match(

    { routes:RoutesComponent, location: req.url },

    (err, redirectLocation, renderProps) => {

        let html;

        if (renderProps) {

            html= renderToString(<RouterContext {...renderProps}/>);

        }

        return res.render('index', { html});

    }

);

});

>All comments

Please read the docs before filing an issue: https://reacttraining.com/react-router/web/guides/server-rendering

Was this page helpful?
0 / 5 - 0 ratings

Related issues

misterwilliam picture misterwilliam  路  3Comments

Waquo picture Waquo  路  3Comments

andrewpillar picture andrewpillar  路  3Comments

yormi picture yormi  路  3Comments

imWildCat picture imWildCat  路  3Comments