You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem description:
(I've seen #235 and aware of the suppressRefError workaround but it doesn't work for this use case, as demonstrated.)
I'm trying to 'compose'/'chain' Downshift with another 'render prop' component. (My reproduction example is deliberately trivial but composability is, I think, a really useful property of the 'render prop' pattern.)
I have had to hack the Downshift code to make it work:
In render(): this.getRootProps.called = true. (I do call it.)
In validateGetRootPropsCalledCorrectly(): change a throw new Error to console.warn
In input_handleBlur() add a console.log(this._rootNode) just to demonstrate it has been set correctly
Suggested solution:
Perhaps adding a suppressRefError prop to the Downshift component itself to allow this use case?
And thanks so much for Downshift!
The text was updated successfully, but these errors were encountered:
jf248
changed the title
Can't compose Downshift with other 'renderProps' components because of validateGetRootPropsCalledCorrectly
Can't compose Downshift with other 'render props' components because of validateGetRootPropsCalledCorrectly
Jul 26, 2018
jf248
changed the title
Can't compose Downshift with other 'render props' components because of validateGetRootPropsCalledCorrectly
Can't compose Downshift with other 'render prop' components because of validateGetRootPropsCalledCorrectly
Jul 26, 2018
Yes, that works, but it entangles the presentational root div inside the logic components (Downshift and Foo). It prevents us extracting a reusable pure logic component DownshiftWithFoo:
downshift
version: 2.0.19node
version:npm
(oryarn
) version:Reproduction repository:
https://codesandbox.io/s/jjk32o429y
Problem description:
(I've seen #235 and aware of the
suppressRefError
workaround but it doesn't work for this use case, as demonstrated.)I'm trying to 'compose'/'chain' Downshift with another 'render prop' component. (My reproduction example is deliberately trivial but composability is, I think, a really useful property of the 'render prop' pattern.)
I've got the example working in this fork:
https://codesandbox.io/s/oo096p975y
I have had to hack the Downshift code to make it work:
render()
:this.getRootProps.called = true
. (I do call it.)validateGetRootPropsCalledCorrectly()
: change athrow new Error
toconsole.warn
input_handleBlur()
add aconsole.log(this._rootNode)
just to demonstrate it has been set correctlySuggested solution:
Perhaps adding a
suppressRefError
prop to the Downshift component itself to allow this use case?And thanks so much for Downshift!
The text was updated successfully, but these errors were encountered: