Closed rupertchen closed 3 years ago
FYI, the typescript types aren't maintained here, but by the community on DefinitelyTyped, so it's possible the types aren't correct
EDIT: I thought this was the typescript type, sorry for replying too quick
A string actually isn't a wrong type for the PropTypes, as you could do <InfiniteHits hitComponent="my-custom-element" />
that would accept the hit prop.
Describe the bug 🐛
Passing a
hitComponent
that is not a functional component results in a type check warning. Should the type be elementType (introduced in 15.7.0)?To Reproduce 🔍
Steps to reproduce the behavior:
Create a non-functional component. For example by using
React.memo(...)
which returns an object:Use the non-functional component in Hits or InfiniteHits:
Perform search
Open console in dev toolbar to see warning. For example:
A live example helps a lot! We have a simple online template for you to use for your explanations:
https://codesandbox.io/s/vigilant-hofstadter-kzsib?file=/src/App.js
Expected behavior 💭
I expect there to be no warnings.
Environment:
All environments where warnings in console are visible.
Additional context
The current implementation in InfiniteHits also includes
PropTypes.string
which seems incorrect.