File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ Create a mock React component whose implementation can be postponed.
88Create a mock and implement it
99
1010``` js
11+ import {mock } from ' libreact/lib/mock' ;
12+
1113const Player = mock ();
1214
1315// Now you can already use <Player>.
@@ -28,17 +30,16 @@ const MySvg = mock({
2830## Reference
2931
3032``` ts
31- const mock: < TProps > (params ? : ImockParams ) => IMockConstructor < TProps > ;
33+ mock : (params ? : IMockParams ) => IMockComponent ;
3234
33- interface ImockParams {
34- loading? : React .ReactElement < any > ;
35+ interface IMockParams {
36+ loading? : React .ReactElement ;
3537}
3638
37- interface IMockComponent <TProps > {
38- new (props : TProps , context ): IMock <TProps >;
39- implement(Implementation : React .Component <TProps , any > | React .SFC <TProps >);
39+ interface IMockComponent {
40+ implement(Implementation : React .Component | React .SFC );
4041}
4142```
4243
43- - ` loading ` - React element to show while the is not implemented.
44+ - ` loading ` - React element to show while the mock is not implemented.
4445 - ` .implement ` - use this method to set the implementation of your mock coponent.
You can’t perform that action at this time.
0 commit comments