JedWatson / JedWatson/react-select
Should allow for conditional existence of customComponents
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
So, I'm trying to write something like this
type ComponentAProps = {
optionComponent? : OptionComponentType;
}
const ComponentA = ({optionComponent, ...props}) => {
return <Select components={{Option: optionComponent}} {...props} />;
}
Ideally, react-select would identify if the Option component is undefined, however, it looks like it's fully overriding the default Option component here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/react-select/src/components/index.ts around line 141, where custom components are mapped. Trace how an undefined Option value is handled, then verify that omitting optionComponent retains the default Option component and that explicitly supplied components still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100