Add Redux and reducers.

Load i18n files and add dayjs.
This commit is contained in:
Paul
2021-06-18 17:57:08 +01:00
parent 0cba2b362d
commit 27eeb3acd2
25 changed files with 1506 additions and 53 deletions

16
src/redux/connector.tsx Normal file
View 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));
}