React Router Route can call a render function
In General, the React Router Route
component looks like this.
<React path="/triangles" component={Triangles} />
If the current url matches /triangles
then the Triangles
component will
render.
If you want to render something simple however, you can pass down a function with the render
prop.
<React path="/helloworld" render={this.renderHelloWorld} />
With that function defined in the same parent component and returning some jsx
renderHelloWorld = () => {
return (
<div>Hello World!</div>
)
}
Tweet