react-component / react-component/slider
Stateless function components cannot be given refs - Warning when using slider with React 16
Open
Nobody has claimed this yet.
Need Reproduce
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 768
- Avg merge
- 11d 22h
- Merged PRs (30d)
- 5
Description
rc-slider version: 8.4.0
react version: 16.0
When used in this context:
<Slider
min={data.minCredit}
max={data.maxCredit}
step={data.step}
value={credits}
handle={(props) => <CreditHandle {...props} ranges={data.bonusRanges} getCurrentRange={getCurrentRange} />}
onChange={(v) => onChange(v)}
variation="alt"
/>
the following warning is raised
Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.
Check the render method of `ComponentEnhancer(undefined)`.
in CreditHandle (created by ComponentEnhancer(undefined))
in div
in ComponentEnhancer(undefined)
Wasn't able to spot the stateless component where refs are given, maybe someone can find it?
Contributor guide
No contributing guide indexed for this repository
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
Reproduce the warning with rc-slider 8.4.0, React 16, and the Slider usage shown in the issue. Trace the custom CreditHandle render path and ref handling, then verify that the warning no longer appears for this usage and add regression coverage if the repository has a suitable test location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100