[2.0.0-beta.2] Components Option render function issue with innerProps
See original GitHub issueWhile overwriting the Option component I found issue with passing innerProps to the div. Documentation example says:
import React from 'react';
import Select from 'react-select';
const CustomOption = ({ innerProps, isDisabled }) =>
!isDisabled ? (
<div {...innerProps}>// your component internals</div>
) : null;
class Component extends React.Component {
render() {
return <Select components={{ Option: CustomOption }} />;
}
}
But when passing innerProps, I’m getting warning:
React does not recognize the innerRef
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase innerref
instead. If you accidentally passed it from a parent component, remove it from the DOM element.
Code to reproduce:
const optionRenderer = props => {
return (
<div {...props.innerProps}>
{props.data.label}
</div>
);
};
render() {
return (
<Select
placeholder="Select language"
defaultValue={{ value: "EN", label: "English" }}
options={[
{ value: "GB", label: "English" },
{ value: "RU", label: "Russian"}
]}
components={{
Option: optionRenderer
}}
/>
);
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Render Props - React
Render Props. The term “render prop” refers to a technique for sharing code between React components using a prop whose value is a...
Read more >Components - React Select
A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete and ajax support.
Read more >Releases - styled-components
We are planning to release 5.2 on September 2/3, please help us test! yarn add styled-components@test. Preallocate global style placement to ensure cGS...
Read more >React-Select - Replacing Components for custom option content
I would like to have custom designed (select) options. The documentation suggests that Replacing Components would be a method that I could use ......
Read more >Vue.js functional components: What, Why, and When?
Using Vue's functional components can increase rendering ... injections : (v2.3.0+) if using the inject option, this will contain resolved ...
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
I’m getting this error using
<Async />
in2.0.0-beta.6
, whereinnerRef
isundefined
.The error seems to go away with 2.0.0-beta.7