score:2
Accepted answer
you just need to use the spread operators and pass your custom props alongside.
<route exact path="/" component={props => <home props={{ data: "check", ...props }}/>}/>
if you console the props inside home component, you can see the value of data in props.data
Source: stackoverflow.com
Related Query
- How to pass custom props and history to Route
- How can I pass custom props to SwiperSlide and get it onSlideChange function?
- How to pass a custom hook as props and retain parent context?
- Swiperjs. How can I pass custom props to SwiperSlide and get it onSlideChange function?
- How can I pass props and state interface to a React class if I extend a custom class?
- How to pass props in Link and Route component at the same time?
- How can I pass down props through Route and container component?
- How to pass custom props to validate function in redux-form?
- How to properly pass custom data attribute props to child components?
- How to pass props to custom components in react-select
- Drag and Drop in React.js. How to pass custom react component in setDragImage
- how to pass props to the route when using react router <Link>
- How to use custom props and theme with material-ui styled components API (Typescript)?
- With antd custom svg icons, how to pass props down to svg?
- How to use setFieldValue and pass the value as props between components
- How to pass additional props throughout a Route element that has parameters in a Typescript based React Web Application
- How to activate a react route and pass data from the service worker?
- In React, using TypeScript, how do I pass a ref to a custom component using RefForwardingComponent and forwardRef?
- How to fetch data from api and pass it as props
- How to pass props (both states and functions) to the child router component
- Pass component props in Private Route with Typescript and React
- How to pass props to React Big Calendar custom components?
- React router v6 access route params and pass as props
- How to fetch data asynchronously inside component and pass it as props to another component in render?
- How can I pass both the theme and the props in the styled() of Material UI-5?
- How to pass props to route components when using useRoutes?
- How to pass a function as props when both Parent and Child component also a functional component?
- How to pass all parent Props to all nested route children which uses {this.props.children}
- how to avoid key/id problems in reactjs and make props pass from parent to child?
- How do I pass a custom parameter to nextjs dynamic route so I can access it inside getInitialProps
More Query from same tag
- relaunch a function with each update of specific states react
- Uncaught (in promise) TypeError: dispatch is not a function useContext/useReducer
- My react node app not reading data from backend after deploying on heroku
- How can i solve this i am able to send msg and receive but it is not one to one messaging socket io react
- Return HTML tag in array of object map
- this.state.[object].map is not a function
- How to clear input field in Draft-js
- List directory in React
- React component theme using sass variables depending on React prop value
- React component doesnnt re render
- Handle bar Template in React
- How to remove all the white spaces between two words?
- Javascript function- transform from one data structure to another
- React 18 required wrap all setState with #act, how to prevent it
- React. Error: Element type is invalid: expected a string or class/function but got: object
- Change field dynamically in ReactJs
- Double forward slash in url breaks router
- How to use react components from other files
- How to add a new object to a nested object in reducer?
- redux toolkit slice accessing variable problem
- React: Reload logic on route change
- Reactjs: add more data to the state including previous data
- Getting SyntaxError /app/src/index.js: Unexpected token for ReactDOM.render
- How can I pass a DOM element to an HTML attribute? ReactJs/ Javascript
- Reactjs how to lazy load image after DOM is loaded
- React Redux - Loading state too slow - how to solve it
- React with typescript, button function doesn't work
- React fixed size text block
- React - Error while updating from 17.0.1 to 17.0.2
- how to get an image with text on paste event