doc: fix example in readme
This commit is contained in:
parent
4d44818baf
commit
d2c99a578b
2 changed files with 2 additions and 9 deletions
|
@ -36,14 +36,7 @@ const MoviesEndpoint: Endpoint = {
|
||||||
type MoviesResponse = Movie[];
|
type MoviesResponse = Movie[];
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [movies, { data, loading }] = useRequest<MoviesResponse>(MoviesEndpoint);
|
const { data, loading } = useRequest<MoviesResponse>(MoviesEndpoint);
|
||||||
|
|
||||||
React.useEffect(
|
|
||||||
() => {
|
|
||||||
movies();
|
|
||||||
},
|
|
||||||
[movies]
|
|
||||||
);
|
|
||||||
|
|
||||||
return !data ? (
|
return !data ? (
|
||||||
<div>{ loading ? 'Loading...' : 'Something went wrong' }</div>
|
<div>{ loading ? 'Loading...' : 'Something went wrong' }</div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "react-rest-request",
|
"name": "react-rest-request",
|
||||||
"version": "0.3.0",
|
"version": "0.3.1",
|
||||||
"description": "Minimalistic REST API client for React inspired by Apollo",
|
"description": "Minimalistic REST API client for React inspired by Apollo",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"main": "./target/index.js",
|
"main": "./target/index.js",
|
||||||
|
|
Reference in a new issue