mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
fix(flux): fix types for createFunctional (#36023)
This commit is contained in:
parent
324d049ad8
commit
37fa8e39d4
2
types/flux/lib/FluxContainer.d.ts
vendored
2
types/flux/lib/FluxContainer.d.ts
vendored
@ -45,7 +45,7 @@ export function create<TProps, TState, TContext, TStatic>(base: Component<TProps
|
||||
* This is a way to connect stores to a functional stateless view.
|
||||
*/
|
||||
export function createFunctional<TProps, TState>(
|
||||
viewFn: (props: TProps) => React.ReactElement<TState>,
|
||||
viewFn: (props: TState) => React.ReactElement<TState>,
|
||||
getStores: (maybeProps?: TProps, maybeContext?: any) => Array<FluxStore<any>>,
|
||||
calculateState: (prevState?: TState, maybeProps?: TProps, maybeContext?: any) => TState,
|
||||
options?: RealOptions
|
||||
|
||||
@ -65,14 +65,14 @@ const ContainerComponent3 = Container.create<Props, State>(CounterContainer, { w
|
||||
<ContainerComponent3 a="string" b={false} />;
|
||||
|
||||
// Functional flux container with Store
|
||||
const FunctionalContainerComponent = Container.createFunctional<Props, State>(
|
||||
(props) => {
|
||||
const FunctionalContainerComponent = Container.createFunctional(
|
||||
(props: State) => {
|
||||
return <div>
|
||||
{props.a} {props.b}
|
||||
{props.counter}
|
||||
</div>;
|
||||
},
|
||||
() => [Store],
|
||||
(prevState) => ({ counter: Store.getState() })
|
||||
(props: Props) => [Store],
|
||||
(prevState: State, props: Props) => ({ counter: Store.getState() })
|
||||
);
|
||||
|
||||
<FunctionalContainerComponent a="string" b={true} />;
|
||||
<FunctionalContainerComponent a="string" b={false} />;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user