我正在使用react-router browserHistory导航到路径.
browserHistory.push({ pathname: '/mycomponent',state: { someValue: 'value'},});
所以这将导航到mycomponent.一旦我到达mycomponent,我想清除关键someValue.所以当我刷新页面时,它不会包含该值.
export class myComponent extends component { componentwillMount() { const value = this.props.location.state.someValue; // clear state.someValue from history } }
任何帮助,将不胜感激.