Selector for React Final Form
npm install react-final-form-selectorSelector for react-final-form.
```
$ npm install react-final-form-selector
or
``
$ yarn add react-final-form-selector
Now you can use selector like redux selector (reselect is a plus).
Interface:
`typescript
interface User {
id: nuber;
name: string;
}
interface Form {
users: User[];
}
``
Component:
`typescript
export { useFormSelector } from 'react-final-form-selector';
import { FormState } from 'final-form';
import selector from './selector';
interface Props {
idx: number;
}
const Component: React.FC
const { user } = useFormSelector((state: FormState
return (
{user.name}
Selector:
`typescript
import { createSelector } from 'reselect'; // optional const getUser = (state: FormState
``