File tree 3 files changed +11
-1
lines changed
3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 42
42
"dependencies" : {
43
43
"create-react-context" : " ^0.2.3" ,
44
44
"emit-lite" : " ^2.0.0" ,
45
- "prop-types" : " ^15.5.7"
45
+ "prop-types" : " ^15.5.7" ,
46
+ "tiny-invariant" : " ^1.0.3"
46
47
},
47
48
"devDependencies" : {
48
49
"@babel/cli" : " ^7.1.2" ,
Original file line number Diff line number Diff line change 1
1
import React , { PureComponent } from 'react' ;
2
2
import WechatAPIContext from './WechatAPIContext' ;
3
+ import invariant from 'tiny-invariant' ;
3
4
4
5
export default function withWechatAPI ( WrappedComponent ) {
5
6
return class WechatAPIConsumer extends PureComponent {
6
7
renderChildren = ( wechatAPI ) => {
8
+ invariant (
9
+ wechatAPI ,
10
+ 'You should not use <AppTitle> outside <WechatAPIProvider>' ,
11
+ ) ;
7
12
return < WrappedComponent { ...this . props } wechatAPI = { wechatAPI } /> ;
8
13
} ;
9
14
Original file line number Diff line number Diff line change @@ -8591,6 +8591,10 @@ timers-browserify@^2.0.4:
8591
8591
dependencies :
8592
8592
setimmediate "^1.0.4"
8593
8593
8594
+ tiny-invariant@^1.0.3 :
8595
+ version "1.0.3"
8596
+ resolved "http://registry.npm.taobao.org/tiny-invariant/download/tiny-invariant-1.0.3.tgz#91efaaa0269ccb6271f0296aeedb05fc3e067b7a"
8597
+
8594
8598
tmp@^0.0.29 :
8595
8599
version "0.0.29"
8596
8600
resolved "http://registry.npm.taobao.org/tmp/download/tmp-0.0.29.tgz#f25125ff0dd9da3ccb0c2dd371ee1288bb9128c0"
You can’t perform that action at this time.
0 commit comments