Skip to content

Commit e7d1633

Browse files
authored
Update README.md
1 parent 00b8990 commit e7d1633

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,18 @@ ReactDOM.render(<App />, document.getElementById('root'));
4343
## Demo:
4444

4545
[Demo](https://codesandbox.io/s/github/amitdabade/react-use-fetch-demo)
46+
[Storybook](https://amitdabade.github.io/react-use-fetch)
4647

47-
## Options:
48+
## Configurations:
4849

49-
### GET
50+
**GET**
5051
```
5152
useFetch({
5253
url: "https://jsonplaceholder.typicode.com/todos/1"
53-
})
54+
});
5455
```
5556

56-
### POST
57+
**POST**
5758
```
5859
useFetch({
5960
url: "https://jsonplaceholder.typicode.com/posts",
@@ -63,19 +64,34 @@ useFetch({
6364
"id": 1,
6465
"title": "sunt aut facere",
6566
"body": "quia et suscipit"
66-
})
67-
})
67+
})
68+
});
6869
```
6970

70-
### HEADERS
71+
**HEADERS**
7172
```
7273
useFetch({
7374
url: "https://jsonplaceholder.typicode.com/posts",
7475
headers: {
7576
'Accept': 'application/json',
7677
'Content-Type': 'application/json'
7778
}
78-
})
79+
});
80+
```
81+
82+
**Default Config**
83+
```
84+
const config = {
85+
delay: 0,
86+
retry: 0,
87+
refetchInterval: 0,
88+
refetch: Infinity,
89+
responseType: "text",
90+
};
91+
92+
useFetch({
93+
url: "https://jsonplaceholder.typicode.com/posts"
94+
}, config);
7995
```
8096

8197
## License:

0 commit comments

Comments
 (0)