import React, { useState, useEffect } from 'react'; const MyGroups = () => { const [state, setState] = useState({ MyGroups: [ { id: 1, group_title: 'TJ', }, ], }); const callAPI = () => { fetch(`${process.env.REACT_APP_API_ENDPOINT}/groups/`) .then((response) => response.json()) .then((data) => { if (data !== undefined) { setState(data); } }); }; useEffect(() => { callAPI(); }, []); return (