- 把query string解析为对象,注入到props上,方便访问
yarn add react-router-with-query
import withQuery from 'react-router-with-query'
...
export default withQuery(Component)
const { query } = this.props
console.log(query.a) // a = 1, www.baidu.com?a=1
Parse query string to object and inject to component props
yarn add react-router-with-query
import withQuery from 'react-router-with-query'
...
export default withQuery(Component)
const { query } = this.props
console.log(query.a) // a = 1, www.baidu.com?a=1
Parse query string to object and inject to component props