score:0

class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      user: "KungLoad"
    };
  }

  render() {
    return (
      <div>
        <Router>
          <Route exact path="/">
            <Navi user={this.state.user} />
          </Route>
        </Router>
      </div>
    );
  }
}

score:0

<Route exact path="/signin" render={()=> (<Redirect to='/signin'/>)}/>

score:0

import {useLocation} from 'react-router-dom';

 function ComponentB() {

    const location = useLocation();
   
        return (

            <>
               
<div>{location.state.name}</div>

            </>
        )
    }

export default ComponentB;

score:1

<Route exact path="/" render={() => <Navi user={this.state.user} />}  />

Related Query

More Query from same tag