Every line of 'react router 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.
51 onPush(route: Route, props:{ [key: string]: any}):boolean { 52 this.refs.nav.push({...route, component:RouteIOS, passProps:{...props, route: route}}); 53 return true; 54 }
28 push(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 }
19 push(props, route) { 20 if(!props){ 21 props = {}; 22 } 23 route.props = props; 24 this.navigator.push(route); 25 }
40 export function push({ 41 routeName, 42 params, 43 action, 44 }: { 45 routeName: string; 46 params?: object; 47 action?: never; 48 }): StackActionType { 49 if (action !== undefined) { 50 throw new Error( 51 'Sub-actions are not supported for `push`. Remove the `action` key from the options.' 52 ); 53 } 54 55 return StackActions.push(routeName, params); 56 }
56 export function push(routeName: string, params?: NavigationParams) { 57 if (navigationContainer && lastNavigateTime + 500 < Date.now()) { 58 navigationContainer.dispatch( 59 StackActions.push({ 60 routeName, 61 params, 62 }), 63 ); 64 lastNavigateTime = Date.now(); 65 } 66 }
65 function Router(props, context) { 66 _classCallCheck(this, Router); 67 68 _React$Component.call(this, props, context); 69 70 this.state = { 71 location: null, 72 routes: null, 73 params: null, 74 components: null 75 }; 76 }
9 export default function Router() { 10 const [current, setCurrent] = useState('home') 11 useEffect(() => { 12 setRoute() 13 window.addEventListener('hashchange', setRoute) 14 return () => window.removeEventListener('hashchange', setRoute) 15 }, []) 16 function setRoute() { 17 const location = window.location.href.split('/') 18 const pathname = location[location.length-1] 19 console.log('pathname: ', pathname) 20 setCurrent(pathname ? pathname : 'home') 21 } 22 return ( 23 24 <nav> 25 26 27 28 29 30 31 </nav> 32 ) 33 }
160 pushRoute(route) { 161 return this.props.pushRoute(route); 162 }
8 export function Router({children, ...props}) { 9 assert(props.location, 'Router "location" property is missing') 10 11 const routes = useMemo(() => addRoutes(children), []) 12 return renderMatch(routes, props) 13 }
41 export function popToRoute(route:string, passProps:any):Action { 42 return { 43 type: POP_TO_ROUTE, 44 route, 45 passProps, 46 }; 47 }