Skip to content

Commit 5d66625

Browse files
committed
docs: improve mock() docs
1 parent b23c707 commit 5d66625

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

docs/mock.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Create a mock React component whose implementation can be postponed.
88
Create a mock and implement it
99

1010
```js
11+
import {mock} from 'libreact/lib/mock';
12+
1113
const 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.

0 commit comments

Comments
 (0)