@@ -166,7 +166,7 @@ const QUERY = `
166166 }
167167`
168168
169- const App = () => {
169+ function App () {
170170 const request = useFetch (' http://example.com' )
171171
172172 const getTodosForUser = id => request .query (QUERY , { userID: id })
@@ -192,7 +192,7 @@ const MUTATION = `
192192 }
193193`
194194
195- const App = () => {
195+ function App() {
196196 const [todoTitle, setTodoTitle] = useState(' ' )
197197 const request = useFetch(' http: // example.com')
198198
@@ -216,7 +216,7 @@ The `Provider` allows us to set a default `url`, `options` (such as headers) and
216216import { Provider , useQuery , useMutation } from ' use-http'
217217
218218// Query for todos
219- const QueryComponent = () => {
219+ function QueryComponent () {
220220 const request = useQuery (`
221221 query Todos($userID string!) {
222222 todos(userID: $userID) {
@@ -237,7 +237,7 @@ const QueryComponent = () => {
237237}
238238
239239// Add a new todo
240- const MutationComponent = () => {
240+ function MutationComponent() {
241241 const [todoTitle, setTodoTitle] = useState(' ' )
242242
243243 const [data, loading, error, mutate] = useMutation(`
@@ -262,7 +262,7 @@ const MutationComponent = () => {
262262
263263// these are default options and URL used in every request
264264// inside the <Provider />. They can be overwritten individually
265- const App = () => {
265+ function App() {
266266
267267 const options = {
268268 headers: {
@@ -284,7 +284,7 @@ const App = () => {
284284` ` ` jsx
285285import React , { Suspense , unstable_ConcurrentMode as ConcurrentMode , useEffect } from ' react'
286286
287- const WithSuspense = () => {
287+ function WithSuspense () {
288288 const suspense = useFetch (' https://example.com' )
289289
290290 useEffect (() => {
@@ -296,7 +296,7 @@ const WithSuspense = () => {
296296 return < pre> {suspense .data }< / pre>
297297}
298298
299- const App = () => (
299+ function App () (
300300 <ConcurrentMode>
301301 <Suspense fallback="Loading...">
302302 <WithSuspense />
0 commit comments