Multiple Layouts with React Router v4

后端 未结 4 1333
臣服心动
臣服心动 2020-12-13 23:12

I\'m pulling my hair out trying to render multiple layouts with React Router v4.

For instance, I\'d like pages with the following paths to have layout 1:

    <
4条回答
  •  醉话见心
    2020-12-13 23:28

    So, for this you should use render function (https://reacttraining.com/react-router/core/api/Route/render-func)

    A really good article that helped me: https://simonsmith.io/reusing-layouts-in-react-router-4/

    In the end you will be use something like this:

    
     

提交回复
热议问题