-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee54dfd
commit 48f02aa
Showing
2 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React, { Fragment } from 'react'; | ||
import memoizeOne from 'memoize-one'; | ||
|
||
/** | ||
* 获取是否为测试用户 | ||
* 方法是在localStorage上设置 trpg_test: true | ||
*/ | ||
const checkIsTestUser = memoizeOne(() => { | ||
return localStorage.getItem('trpg_test') === 'true'; | ||
}); | ||
|
||
const DevContainer: React.FC<{}> = React.memo((props) => { | ||
return checkIsTestUser() ? <Fragment>{props.children}</Fragment> : null; | ||
}); | ||
|
||
export default DevContainer; |