I'm trying to use a database I set up in a headless cms known as contentful. The problem is, all the tutorials I watched uses Class components to handle state. I learned useContext for the Context API method, which I find to be more appealing and less of a headache. I know how to request data from conetextful, but I don't know how to use the data outside of the use of a Class component. I suppose one question I could ask is whether it's even possible to use contentful with an object or function component?
import React from 'react';
import ReactDOM from 'react-dom';
import {BrowserRouter as Router} from 'react-router-dom';
import App from './App';
import 'w3-css';
import {BsyndContext} from './context/bsyndContext';
import Client from './Contentful';
Client.getEntries().then(res => console.log(res.items))
ReactDOM.render(
<BsyndContext.Provider value={"data here"} >
<Router>
<App />
</Router>
</BsyndContext.Provider>
,
document.getElementById('root')
);