@@ -166,7 +166,7 @@ const QUERY = `
166
166
}
167
167
`
168
168
169
- const App = () => {
169
+ function App () {
170
170
const request = useFetch (' http://example.com' )
171
171
172
172
const getTodosForUser = id => request .query (QUERY , { userID: id })
@@ -192,7 +192,7 @@ const MUTATION = `
192
192
}
193
193
`
194
194
195
- const App = () => {
195
+ function App() {
196
196
const [todoTitle, setTodoTitle] = useState(' ' )
197
197
const request = useFetch(' http: // example.com')
198
198
@@ -216,7 +216,7 @@ The `Provider` allows us to set a default `url`, `options` (such as headers) and
216
216
import { Provider , useQuery , useMutation } from ' use-http'
217
217
218
218
// Query for todos
219
- const QueryComponent = () => {
219
+ function QueryComponent () {
220
220
const request = useQuery (`
221
221
query Todos($userID string!) {
222
222
todos(userID: $userID) {
@@ -237,7 +237,7 @@ const QueryComponent = () => {
237
237
}
238
238
239
239
// Add a new todo
240
- const MutationComponent = () => {
240
+ function MutationComponent() {
241
241
const [todoTitle, setTodoTitle] = useState(' ' )
242
242
243
243
const [data, loading, error, mutate] = useMutation(`
@@ -262,7 +262,7 @@ const MutationComponent = () => {
262
262
263
263
// these are default options and URL used in every request
264
264
// inside the <Provider />. They can be overwritten individually
265
- const App = () => {
265
+ function App() {
266
266
267
267
const options = {
268
268
headers: {
@@ -284,7 +284,7 @@ const App = () => {
284
284
` ` ` jsx
285
285
import React , { Suspense , unstable_ConcurrentMode as ConcurrentMode , useEffect } from ' react'
286
286
287
- const WithSuspense = () => {
287
+ function WithSuspense () {
288
288
const suspense = useFetch (' https://example.com' )
289
289
290
290
useEffect (() => {
@@ -296,7 +296,7 @@ const WithSuspense = () => {
296
296
return < pre> {suspense .data }< / pre>
297
297
}
298
298
299
- const App = () => (
299
+ function App () (
300
300
<ConcurrentMode>
301
301
<Suspense fallback="Loading...">
302
302
<WithSuspense />
0 commit comments