@unitedstatespowersquadrons/components 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Readme.md +1 -4
- package/Reducer/buildUnreducableState.tsx +4 -4
- package/package.json +1 -1
package/Readme.md
CHANGED
|
@@ -55,13 +55,10 @@ If you only need access to app state, but no dispatchable events, you can use
|
|
|
55
55
|
the simplified generator function:
|
|
56
56
|
|
|
57
57
|
```ts
|
|
58
|
-
import { createContext } from "react";
|
|
59
58
|
import { buildUnreducableState } from "@unitedstatespowersquadrons/components";
|
|
60
59
|
import { AppState } from "./types";
|
|
61
60
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
export const { AppProvider, useAppState } = buildUnreducableState<AppState>(StateContext);
|
|
61
|
+
export const { AppProvider, useAppState } = buildUnreducableState<AppState>();
|
|
65
62
|
```
|
|
66
63
|
|
|
67
64
|
## Automated Testing
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React, { useContext } from "react";
|
|
1
|
+
import React, { createContext, useContext } from "react";
|
|
2
2
|
|
|
3
3
|
interface InitialAppProps<AppState> {
|
|
4
4
|
initialState: AppState;
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export default function buildUnreducableState<AppState>(
|
|
9
|
-
StateContext
|
|
10
|
-
|
|
8
|
+
export default function buildUnreducableState<AppState>() {
|
|
9
|
+
const StateContext = createContext<AppState | null>(null);
|
|
10
|
+
|
|
11
11
|
const AppProvider = (props: InitialAppProps<AppState>) => {
|
|
12
12
|
return (
|
|
13
13
|
<StateContext.Provider value={props.initialState}>
|