Languages
[Edit]
EN

React / react-router - inline rendering

0 points
Created by:
Palpys
764

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.

Alternative titles

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

React - react-router

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join