mirror of
https://github.com/revoltchat/revite.git
synced 2025-02-23 16:50:56 -05:00
17 lines
558 B
TypeScript
17 lines
558 B
TypeScript
|
import { State } from ".";
|
||
|
import { h } from "preact";
|
||
|
//import { memo } from "preact/compat";
|
||
|
import { connect, ConnectedComponent } from "react-redux";
|
||
|
|
||
|
export function connectState<T>(
|
||
|
component: (props: any) => h.JSX.Element | null,
|
||
|
mapKeys: (state: State, props: T) => any,
|
||
|
useDispatcher?: boolean
|
||
|
): ConnectedComponent<(props: any) => h.JSX.Element | null, T> {
|
||
|
return (
|
||
|
useDispatcher
|
||
|
? connect(mapKeys, dispatcher => { return { dispatcher } })
|
||
|
: connect(mapKeys)
|
||
|
)(component);//(memo(component));
|
||
|
}
|