In react-router v3 I could access it with props.location.query.foo
(if the current location was ?foo=bar
)
In react-router-dom@4.0.0
You may get the following error while creating an optimized production build when using query-string module.
Failed to minify the code from this file: ./node_modules/query-string/index.js:8
To overcome this, kindly use the alternative module called stringquery which does the same process well without any issues while running the build.
import querySearch from "stringquery";
var query = querySearch(this.props.location.search);
Thank you.