10 examples of 'props.history.push' in JavaScript

Every line of 'props.history.push' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
6function pushHistory(e, props) {
7 e.preventDefault()
8 props.onClick && props.onClick()
9 history.push({
10 pathname: props.to,
11 search: e.target.search
12 })
13}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

28push(params = {}) {
29 return NavigationSpecific.push(this, params);
30}
19push(props, route) {
20 if(!props){
21 props = {};
22 }
23 route.props = props;
24 this.navigator.push(route);
25}
28push(props, route) {
29 let routesList = this.navigator.getCurrentRoutes()
30 let nextIndex = routesList[routesList.length - 1].index + 1
31 route.props = props
32 route.index = nextIndex
33 this.navigator.push(route)
34}
48export function pushHistoryPath(history, path, search) {
49 pushOrUpdateHistory(history, false, null, null, path, search);
50}
23export function History(props: HistoryProps) {
24 React.useEffect(() => {
25 if (process.env.NODE_ENV !== 'production') {
26 console.warn(
27 `Deprecation Warning: "<History>" is deprecated. It will be removed in a future version.`,
28 )
29 }
30 }, [])
31
32 return (
33 <NaviContext.Consumer>
34 {context => props.children(context.navigation._history)}
35 </NaviContext.Consumer>
36 )
37}
20setHistory(history: CustomHistory) {
21 this.history = history
22}
76push(state) {
77 const newHistory = this.merge({
78 undos: this.undos.push(snapshot(state, this.merged)),
79 redos: new Stack(),
80 merged: 1
81 });
82
83 return newHistory.prune();
84}
166componentWillReceiveProps(nextProps, nextContext) {
167 if (nextContext.historyList.length !== this.context.historyList.length) {
168 LayoutAnimation.easeInEaseOut();
169 }
170}
4push (action) {
5 this.state = this.reduce(this.state, [action])
6 return this.rerender()
7}

Related snippets