question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Allow passing props to custom components

See original GitHub issue

My 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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
TotallWARcommented, Oct 2, 2018

@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

7reactions
mike391commented, Sep 29, 2018

This would be very useful. +1

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found