Feature request: Allow passing props to custom components
See original GitHub issueMy usecase is as such:
I want to add a button/content below the MenuList
.
This is done by making a custom menu:
const Menu = ({actionRenderer, ...props}) => {
return components.Menu && (
<Fragment>
<components.Menu {...props}>
{props.children}
</components.Menu>
{actionRenderer && actionRenderer()}
</Fragment>
)
}
But as far as i’ve read in the documentation, it’s impossible to pass your own props through the Select
to you own components…?
May a whitelist solution like this could work…?
<Select
...
actionRenderer={()=> ...}
passProps={['actionRenderer']}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How To Customize React Components with Props
In this tutorial, you'll create custom components by passing props to your component. Props are arguments that you provide to a JSX element....
Read more >Props! — and how to pass props to components in React ...
This a common question for React beginners and the answer for it is brief: there is no way to pass props from a...
Read more >How passing props to component works in React
Master how to pass props (properties) to components in React with this useful beginner's guide, including demo code.
Read more >Get props value suggestion in custom react component
You need to use typescript where you need to declare props interface. then you will get suggestion by using intelliSense feature of editor....
Read more >How to use Props in React - Robin Wieruch
They are one of the early things you will learn in React after grasping React's JSX syntax. Essentially React component props are used...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mikkelwf i have found solution. You can pass your custom props to Select. And then you can take it in your custom component from
props.selectProps.yourCustomProp
This would be very useful. +1