DEV Community

Discussion on: How To Export Data To Excel From Api Using React

Collapse
 
jasurkurbanov profile image
Jasur Kurbanov • Edited

1) Download this repo github.com/jasurkurbanov/react-api...

2) Inside App.js replace useEffect to the code below

React.useEffect(() => {
    const fetchData = () => {
      axios.get('https://www.arbeitnow.com/api/job-board-api').then(postData => {

        // reshaping the array
        const customHeadings = postData.data.data.map(item => ({
          "Company Name": item.company_name,
          "Location": item.location,
          "isRemote": item.remote ? 'Yes' : 'No'
        }))

        setData(customHeadings)
      })
    }
    fetchData()
  }, [])
Enter fullscreen mode Exit fullscreen mode

3) Result
image

Hope it helped to you)