Skip to content

Commit abbf6d3

Browse files
no more observe() example
1 parent 2904af4 commit abbf6d3

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,9 @@ export default Coroutine.create(PokemonInfoPage);
4343
```
4444

4545
```javascript
46-
class MyComponent extends Coroutine {
47-
async observe() {
48-
try {
49-
const users = await Users.retrieve();
50-
return { status: 'success', users };
51-
} catch (error) {
52-
return { status: 'failure', error };
53-
}
54-
}
55-
56-
render() {
57-
switch (this.state.data.status) {
58-
case 'success':
59-
return <UserList users={this.state.data.users} />;
60-
case 'failure':
61-
return <ErrorMessage error={this.state.data.error} />;
62-
default:
63-
return <Loading />;
64-
}
65-
}
46+
function* MovieInfoLoader({ movieId }) {
47+
const movieData = yield movieCache.read(movieId);
48+
return <MovieInfo data={movieData} />;
6649
}
6750
```
6851

0 commit comments

Comments
 (0)