Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
iamthesiz authored Jun 20, 2019
1 parent ba26cc4 commit b912f72
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ const QUERY = `
}
`

const App = () => {
function App() {
const request = useFetch('http://example.com')

const getTodosForUser = id => request.query(QUERY, { userID: id })
Expand All @@ -192,7 +192,7 @@ const MUTATION = `
}
`
const App = () => {
function App() {
const [todoTitle, setTodoTitle] = useState('')
const request = useFetch('http://example.com')

Expand All @@ -216,7 +216,7 @@ The `Provider` allows us to set a default `url`, `options` (such as headers) and
import { Provider, useQuery, useMutation } from 'use-http'

// Query for todos
const QueryComponent = () => {
function QueryComponent() {
const request = useQuery(`
query Todos($userID string!) {
todos(userID: $userID) {
Expand All @@ -237,7 +237,7 @@ const QueryComponent = () => {
}
// Add a new todo
const MutationComponent = () => {
function MutationComponent() {
const [todoTitle, setTodoTitle] = useState('')
const [data, loading, error, mutate] = useMutation(`
Expand All @@ -262,7 +262,7 @@ const MutationComponent = () => {
// these are default options and URL used in every request
// inside the <Provider />. They can be overwritten individually
const App = () => {
function App() {
const options = {
headers: {
Expand All @@ -284,7 +284,7 @@ const App = () => {
```jsx
import React, { Suspense, unstable_ConcurrentMode as ConcurrentMode, useEffect } from 'react'

const WithSuspense = () => {
function WithSuspense() {
const suspense = useFetch('https://example.com')

useEffect(() => {
Expand All @@ -296,7 +296,7 @@ const WithSuspense = () => {
return <pre>{suspense.data}</pre>
}

const App = () => (
function App() (
<ConcurrentMode>
<Suspense fallback="Loading...">
<WithSuspense />
Expand Down

0 comments on commit b912f72

Please sign in to comment.