We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey, thank you for this great library. 👍🏻 Can you help how a Typescript variant of the usePropsSelector would look like?
usePropsSelector
const usePropsSelector = (selector, props) => { const id = selector.idSelector && selector.idSelector(null, props); useEffect(() => selector.use && selector.use(id), [selector, id]); return useSelector(x => selector(x, props)); };
The text was updated successfully, but these errors were encountered:
@martinkutter Hi! Please, try this
import * as React from 'react' import { useSelector } from 'react-redux' import type { OutputSelector, OutputParametricSelector } from 'redux-views' type Sel = (OutputSelector<any, any, any> | OutputParametricSelector<any, any, any, any>) & { use?: (...args: any[]) => any idSelector?: (...args: any[]) => any } export const usePropsSelector = <T extends Sel = Sel>(selector: T, props: any): ReturnType<typeof selector> => { const id = selector.idSelector && selector.idSelector(null, props) React.useEffect(() => selector.use && selector.use(id), [selector, id]) return useSelector(state => selector(state, props)) }
Sorry, something went wrong.
No branches or pull requests
Hey, thank you for this great library. 👍🏻
Can you help how a Typescript variant of the
usePropsSelector
would look like?The text was updated successfully, but these errors were encountered: