-
-
Save Narven/9d37e1ebbc46b74f347d320b2a598bd8 to your computer and use it in GitHub Desktop.
Using custom props with a Redux form in Typescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react'; | |
| import { | |
| Field as FormField, | |
| InjectedFormProps, | |
| reduxForm, | |
| } from 'redux-form'; | |
| interface CustomProps { | |
| customText: string; | |
| } | |
| class FormComponent extends React.Component<CustomProps & InjectedFormProps<{}, CustomProps>> { | |
| render() { | |
| const { handleSubmit, customText } = this.props; | |
| return ( | |
| <form onSubmit={handleSubmit}> | |
| <div> | |
| <p>{customText}</p> | |
| </div> | |
| </form> | |
| ); | |
| } | |
| } | |
| export const Form = reduxForm<{}, CustomProps>({ | |
| form: 'form', | |
| })(FormComponent); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment