mirror of
https://github.com/stoatchat/for-legacy-web.git
synced 2026-03-09 18:15:28 +00:00
Add Redux and reducers.
Load i18n files and add dayjs.
This commit is contained in:
16
src/redux/connector.tsx
Normal file
16
src/redux/connector.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
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));
|
||||
}
|
||||
Reference in New Issue
Block a user