Horje
how to pass data between routes in react Code Example
passing data in route react
<Route path="/" component={() => <Search name={this.props.name} />} /> 
how to pass data between routes in react
// React Router v6
// pass data between routes
// ---------------------------------------------------------------------
// sender.js/jsx
import { useNavigate } from "react-router-dom";

const navigate = useNavigate();
navigate('/other-page', { state: { username: 'user', password: '696' } });
// ---------------------------------------------------------------------
// receiver.js/jsx
import { useLocation } from "react-router-dom";

const location = useLocation();
console.log(location.state) // gives: {username: 'user', password: '696'}
passing data in route react
render={routeProps => <Search name={this.props.name} {...routeProps} />}




Javascript

Related
js unslick Code Example js unslick Code Example
regression to the mean using javascript Code Example regression to the mean using javascript Code Example
ist to gmt javascript Code Example ist to gmt javascript Code Example
resolver not showing content angular Code Example resolver not showing content angular Code Example
nestjs test db Code Example nestjs test db Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7