Passing state via this.history.pushState()

后端 未结 1 615
执念已碎
执念已碎 2020-12-31 04:43

I\'m using react-router 1.0 and their integration of history.

import { createHistory, useBasename } from \'history\'
         


        
1条回答
  •  天涯浪人
    2020-12-31 05:03

    The state is on location so, you can access it via props if it's your route component: this.props.location.state or get the location object of the context.

    Check out Pinterest example in the v3 docs, which is doing exactly what you want.

    edit: Here is the link to the example in React Router v4: https://reacttraining.com/react-router/web/example/modal-gallery

    0 讨论(0)
提交回复
热议问题