F
F
Fuckingawesomenigga2019-09-06 11:19:37
React
Fuckingawesomenigga, 2019-09-06 11:19:37

How to implement page transitions in React?

In Maine:

class Main extends Component {
    render() {
        return (
            <div className="main">
    	        <Header />
        <Switch>
          <Route exact path='/' component={Home}/>
          <Route exact path='/example' component={Examlpe}/>
        </Switch>
            </div>
        );
    }
}

The Header contains a link:
<Link to='/example'>Text</Link>
When you click on it, the address changes, but the component does not.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
hzzzzl, 2019-09-06
@hzzzzl

should work, does the console write any errors?
Example?

P
Prego666, 2019-09-06
@Prego666

And if Link is not wrapped in Route, will it work?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question