From def2102ff912d538d30b60f417937c5e135f46cc Mon Sep 17 00:00:00 2001 From: Matt C Date: Fri, 24 Feb 2017 09:41:18 +1100 Subject: [PATCH] [redux-form] Allow the "reduxForm()" function to wrap stateless functional components and not just class components. --- redux-form/lib/reduxForm.d.ts | 4 +++- redux-form/redux-form-tests.tsx | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/redux-form/lib/reduxForm.d.ts b/redux-form/lib/reduxForm.d.ts index 512797a39c..0350e69f03 100644 --- a/redux-form/lib/reduxForm.d.ts +++ b/redux-form/lib/reduxForm.d.ts @@ -1,5 +1,6 @@ import { Component, + StatelessComponent, ReactElement, SyntheticEvent, ReactEventHandler, @@ -20,7 +21,8 @@ export function reduxForm( ): FormDecorator; export interface FormDecorator { - (component: T): T & Form; + )>(component: T): + T & Form; } export interface Config { diff --git a/redux-form/redux-form-tests.tsx b/redux-form/redux-form-tests.tsx index 244ab11382..e660b6b0b5 100644 --- a/redux-form/redux-form-tests.tsx +++ b/redux-form/redux-form-tests.tsx @@ -50,3 +50,9 @@ class MyForm extends Component<{}, {}> { ); } } + +const MyStatelessFunctionalComponent: React.SFC = () =>
; + +reduxForm({ + form: 'mySFCForm' +})(MyStatelessFunctionalComponent);