I have been working on the backend and trying to learn React. So, sorry if it is a stupid question. I used the fetch component for API calls in my component with React Functions.
import React, {useState} from "react";
import { Row } from "react-bootstrap";
import * as Constants from '../Constants';
import './index.css';
function ActivitySuggestions(){
var items = null;
React.useEffect(() => {
const url = "https://www.boredapi.com/api/activity";
fetch(url)
.then((response) => response.json())
.then((json) => (items = json))
.catch((error) => console.log(error));
}, []);
return(
<div>items</div>
);
}
export default ActivitySuggestions
But upon execution, I am getting the string 'text', or whatsoever the text I am providing inside the div, rendered on the browser. Please help me to understand where I am going wrong.