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:
import { Route } from react-router-dom
<Route
path="/home"
render={() => (
<div>
<h2>Homepage</h2>
...
</div>
)}
/>
Note:
The render method is also used to pass props to components. You can read about it here.