EN
React / react-router - inline rendering
0 points
Instead of specifying the component in a standard way, we also have the option to enter the code inline using the render
method.
Quick solution:
xxxxxxxxxx
1
import { Route } from react-router-dom
2
3
<Route
4
path="/home"
5
render={() => (
6
<div>
7
<h2>Homepage</h2>
8
...
9
</div>
10
)}
11
/>
Note:
The render method is also used to pass props to components. You can read about it here.