Skip to content

Instantly share code, notes, and snippets.

@samipshah100
Last active September 26, 2020 09:34
Show Gist options
  • Save samipshah100/52d35a9cd7b78ef51923ead2e5eed774 to your computer and use it in GitHub Desktop.
Save samipshah100/52d35a9cd7b78ef51923ead2e5eed774 to your computer and use it in GitHub Desktop.
import React, { useEffect } from 'react'
import { useFetchEffect } from '../../hooks/useFetchEffect'
const DemoComponent = () => {
const url = 'https://jsonplaceholder.typicode.com/posts' // sample api
const data = useFetchEffect(url)
return <div className="DemoComponent">{data.map(<div>{data.name}</div>)}</div>
}
export default DemoComponent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment