Last active
April 8, 2019 06:23
-
-
Save kmsheng/87445e3f798f76dc9fb91e5b6798618a to your computer and use it in GitHub Desktop.
redux-react-hook / src / index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved | |
import {create} from './create'; // 將 create 方法從檔案 create.ts 引入 | |
// 底下呼叫 create 方法的 return 結果 StoreContext, useDispatch 和 useMappedState export 出去 | |
// 這樣外部檔案可以使用 import 語法叫用 | |
export const {StoreContext, useDispatch, useMappedState} = create< | |
any, | |
any, | |
any | |
>(); | |
// 單獨把 create 方法 export 出去。這有兩個用途: | |
// 1. 給 TypeScript 用的 ( 外部檔案定義 IState 與 Action ) | |
// 2. 如果你有多個 redux store | |
// https://github.com/kmsheng/redux-react-hook/tree/medium-20190408#create | |
export {create}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment