Skip to content

Instantly share code, notes, and snippets.

@iamtmrobinson
Created January 8, 2018 14:49
Show Gist options
  • Select an option

  • Save iamtmrobinson/d4bb6e9297300b787891337fe9e07c42 to your computer and use it in GitHub Desktop.

Select an option

Save iamtmrobinson/d4bb6e9297300b787891337fe9e07c42 to your computer and use it in GitHub Desktop.
Using custom props with a Redux form in Typescript
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);
@Honka3rd
Copy link
Copy Markdown

stared!

@Goran7777
Copy link
Copy Markdown

Goran7777 commented Aug 8, 2021

Thank you buddy,preety hard task.One more star (Y).Cheers.

@ChristopherHButler
Copy link
Copy Markdown

Has anyone converted this to a functional component?

@myCatPear
Copy link
Copy Markdown

omg, thx!!

@qTheSky
Copy link
Copy Markdown

qTheSky commented Oct 4, 2022

thank you very much

@richcarrot
Copy link
Copy Markdown

This is still paying dividends! Helped me today, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment