Skip to content

Instantly share code, notes, and snippets.

@almazmusic
Last active September 22, 2020 14:41
Show Gist options
  • Save almazmusic/c18fb70f79ab33deaf9e37e39d0f1fd0 to your computer and use it in GitHub Desktop.
Save almazmusic/c18fb70f79ab33deaf9e37e39d0f1fd0 to your computer and use it in GitHub Desktop.
reduxForm typing
import React from "react";
import { InjectedFormProps, reduxForm } from "redux-form";
type FormType = {
input1: string;
};
type ComponentProps = {};
type InjectedProps = InjectedFormProps<FormType, ComponentProps>;
const Form: React.FunctionComponent<InjectedProps & ComponentProps> = ({
handleSubmit,
}) => {
const onSubmit = (values: FormType) => {
console.log("values", values);
};
return (
<form onSubmit={handleSubmit(onSubmit)}>
<input type="text" name="input1" />
</form>
);
};
export const TrackingAdd = reduxForm<FormType, ComponentProps>({
form: "test.form",
enableReinitialize: true,
keepDirtyOnReinitialize: true,
})(Form);
@almazmusic
Copy link
Author

Thanks! This was just too hard to figure out without any documentation...

Glad, that this helps.

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