Closed joshgeller closed 2 years ago
@joshgeller having this same problem right now. What do you mean by wrapping SearchBox in a higher-order component? Shouldn't queryHook work correctly no matter what? From what I'm looking at, InstantSearch is actually passing the queryHook prop to the HTML element <div>
inside the SearchBox, as part of the ...props
, which is not what the docs say should happen.
Relevant error:
Warning: React does not recognize the queryHook
prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase queryhook
instead. If you accidentally passed it from a parent component, remove it from the DOM element.
at div
at SearchBox (webpack-internal:///./node_modules/react-instantsearch-hooks-web/dist/es/ui/SearchBox.js:71:24)
at SearchBox (webpack-internal:///./node_modules/react-instantsearch-hooks-web/dist/es/widgets/SearchBox.js:16:94)
at div
at InstantSearch (webpack-internal:///./node_modules/react-instantsearch-hooks/dist/es/components/InstantSearch.js:17:23)
It's the trace that seems to highlight the issue here. The SearchBox component is passing all of its props to its
Indeed there's an issue in the <SearchBox>
component. We should destructure the props to forward only the DOM props to the UI component.
🐛 Bug description
SearchBox
widget does not acceptqueryHook
prop.🔍 Bug reproduction
Steps to reproduce the behavior:
Check console for error:
💭 Expected behavior
SearchBox
widget should acceptqueryHook
prop in accordance with the docs:https://www.algolia.com/doc/api-reference/widgets/search-box/react-hooks/#widget-param-queryhook
Environment