i got this error fetching data just for practice i don't wanna use JSON.stringfy i don't think will be good practice, solve it with details please thank you
Error: Objects are not valid as a React child (found: object with keys {title, episode_id, opening_crawl, director, producer, release_date, characters, planets, starships, vehicles, species, created, edited, url}). If you meant to render a collection of children, use an array instead.
import { useState, useEffect, Fragment } from 'react';
import './App.css';
function App() {
const [data, setData] = useState([]);
useEffect(() => {
const fetching = async () => {
const response = await fetch('https://swapi.dev/api/films')
const { results } = await response.json();
const transformedData = results.map((el) => {
return {
id: el.episode_id,
title: el.title,
text: el.opening_crawl,
date: el.releaseDate
};
});
setData(transformedData);
}
fetching();
})
const outputedData = data.map((el) => {
<div>
<p>{el.id}</p>
<p>{el.title}</p>
<p>{el.text}</p>
<p>{el.date}</p>
</div>
})
return (
<div className="App">
{outputedData}
</div>
);
}
export default App;
console.log(results)
6) [{…}, {…}, {…}, {…}, {…}, {…}]0: {title: "A New Hope", episode_id: 4......}