Languages
[Edit]
EN

React / react-router - inline rendering

0 points
Created by:
Dirask JS Member
3460

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.

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