Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

rapaz o código só funciona a parte principal e a de favoritos agora

aparece esse código de erro:

ERROR
_pages_Inicio_Json_db_json__WEBPACK_IMPORTED_MODULE_1__.find is not a function
TypeError: _pages_Inicio_Json_db_json__WEBPACK_IMPORTED_MODULE_1__.find is not a function
    at Player (http://localhost:3000/static/js/bundle.js:1176:73)
    at renderWithHooks (http://localhost:3000/static/js/bundle.js:26720:22)
    at mountIndeterminateComponent (http://localhost:3000/static/js/bundle.js:30006:17)
    at beginWork (http://localhost:3000/static/js/bundle.js:31302:20)
    at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/bundle.js:16312:18)
    at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/bundle.js:16356:20)
    at invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:16413:35)
    at beginWork$1 (http://localhost:3000/static/js/bundle.js:36287:11)
    at performUnitOfWork (http://localhost:3000/static/js/bundle.js:35534:16)
    at workLoopSync (http://localhost:3000/static/js/bundle.js:35457:9)
ERROR
_pages_Inicio_Json_db_json__WEBPACK_IMPORTED_MODULE_1__.find is not a function
TypeError: _pages_Inicio_Json_db_json__WEBPACK_IMPORTED_MODULE_1__.find is not a function
    at Player (http://localhost:3000/static/js/bundle.js:1176:73)
    at renderWithHooks (http://localhost:3000/static/js/bundle.js:26720:22)
    at mountIndeterminateComponent (http://localhost:3000/static/js/bundle.js:30006:17)
    at beginWork (http://localhost:3000/static/js/bundle.js:31302:20)
    at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/bundle.js:16312:18)
    at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/bundle.js:16356:20)
    at invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:16413:35)
    at beginWork$1 (http://localhost:3000/static/js/bundle.js:36287:11)
    at performUnitOfWork (http://localhost:3000/static/js/bundle.js:35534:16)
    at workLoopSync (http://localhost:3000/static/js/bundle.js:35457:9)
ERROR
_pages_Inicio_Json_db_json__WEBPACK_IMPORTED_MODULE_1__.find is not a function
TypeError: _pages_Inicio_Json_db_json__WEBPACK_IMPORTED_MODULE_1__.find is not a function
    at Player (http://localhost:3000/static/js/bundle.js:1176:73)
    at renderWithHooks (http://localhost:3000/static/js/bundle.js:26720:22)
    at mountIndeterminateComponent (http://localhost:3000/static/js/bundle.js:30006:17)
    at beginWork (http://localhost:3000/static/js/bundle.js:31302:20)
    at beginWork$1 (http://localhost:3000/static/js/bundle.js:36265:18)
    at performUnitOfWork (http://localhost:3000/static/js/bundle.js:35534:16)
    at workLoopSync (http://localhost:3000/static/js/bundle.js:35457:9)
    at renderRootSync (http://localhost:3000/static/js/bundle.js:35430:11)
    at recoverFromConcurrentError (http://localhost:3000/static/js/bundle.js:34922:24)
    at performSyncWorkOnRoot (http://localhost:3000/static/js/bundle.js:35131:24)
2 respostas

meu código:

import Banner from "componentes/Banner";
import Card from "componentes/Card";
import Titulo from "componentes/Titulo";
import styles from './Inicio.module.css';
import { useEffect, useState } from "react";


export default function Inicio(){
    const [videos, setVideos] = useState([]);

    useEffect(() =>{
        fetch('https://my-json-server.typicode.com/Santegas/cinetag-api/videos')
            .then(resposta => resposta.json())
            .then(dados => {
                setVideos(dados)
            })
    }, [])

    return(
        <>
        <Banner imagens="home"/>
        <Titulo>
            <h1>Clique nos cards e conheça os personagens!</h1>
        </Titulo>
        <section className={styles.container}>
            {videos.map((video) => {
                return <Card {...video} key={video.id} />;
            })}
        </section>
        </>
)}

DB.JSON:

{
        "videos":[
    {
        "id": 1,
        "titulo": "Sombra",
        "capa": "./imagens/card1.png",
        "link": "https://youtu.be/Og5-Pm4HNlI"
    },
    {
        "id": 2,
        "titulo": "Reaper",
        "capa": "./imagens/card2.png",
        "link": "https://youtu.be/nFP65i141to"
    },
    {
        "id": 3,
        "titulo": "Junkrat",
        "capa": "./imagens/card3.png",
        "link": "https://youtu.be/DqhiLbRXGUQ"
    },
    {
        "id": 4,
        "titulo": "Winston",
        "capa": "./imagens/card4.png",
        "link": "https://youtu.be/pwFu8kEsUW4"
    }
]
}
solução!

arrumei professora mostrou na próxima aula