react pass prop to route component code example
Example 1: route pass props to component
<Route
path='/dashboard'
render={(props) => (
<Dashboard {...props} isAuthed={true} />
)}
/>
Example 2: react pass parameter to component
import React, { Component } from 'react'; class App extends Component { render() { return ( <div> <Greeting /> </div> ); }} class Greeting extends Component { render() { const greeting = 'Welcome to React'; return <h1>{greeting}</h1>; }} export default App;