taco is a friend of bluey 🥥🌴
taco is a friend of bluey 🥥🌴
TTCTheo's Typesafe Cult
Created by taco is a friend of bluey 🥥🌴 on 8/7/2023 in #questions
Why do I get this error? `Error: result.map is not a function`
Here is my code:
import { use } from "react";
import { TMovie } from "../api/movies/types/MovieTypes";
import { MovieCard } from "./MovieCard";

export default function MovieList({
moviePromise,
}: {
moviePromise: Promise<TMovie[]>;
}) {
const result = use(moviePromise) as TMovie[];

console.log(result);
return (
<div>
{result.map((results, id) => (
<MovieCard key={id} results={results.results} />
))}
</div>
);
}

js
import { use } from "react";
import { TMovie } from "../api/movies/types/MovieTypes";
import { MovieCard } from "./MovieCard";

export default function MovieList({
moviePromise,
}: {
moviePromise: Promise<TMovie[]>;
}) {
const result = use(moviePromise) as TMovie[];

console.log(result);
return (
<div>
{result.map((results, id) => (
<MovieCard key={id} results={results.results} />
))}
</div>
);
}

js
1 replies
TTCTheo's Typesafe Cult
Created by taco is a friend of bluey 🥥🌴 on 8/5/2023 in #questions
Converting api data to a zod object
Hi. currently trying to build a lil poke app using the nextjs app directory, typescript, and zod. What's the quickest way to convert json to a zod object because the pokeapi data for ONE pokemon looks... scary
4 replies
TTCTheo's Typesafe Cult
Created by taco is a friend of bluey 🥥🌴 on 10/22/2022 in #questions
Getting an error saying `TypeError movies.map is not a function`
import type { GetStaticProps, NextPage } from "next"; import MovieTypes from "../types/MovieTypes"; import MovieCard from "../components/MovieCard"; // type Props = { // movies: MovieTypes[]; // }; const Home = ({ movies }: { movies: MovieTypes | any }) => { return ( <div className="h-screen w-screen flex flex-col"> {movies.map((movie: MovieTypes) => ( <div className="m-24 border p-4 border-lime-600 justify-center" key={movie.id} > <MovieCard movies={movie} /> </div> ))} </div> ); }; export const getStaticProps: GetStaticProps = async () => { const res = await fetch( "https://api.themoviedb.org/3/movie/popular?api_key=KEY" ); const movies = await res.json(); // console.log(results); return { props: { movies, }, }; }; export default Home;
9 replies
TTCTheo's Typesafe Cult
Created by taco is a friend of bluey 🥥🌴 on 10/9/2022 in #questions
Just started trying to learn prisma through the docs and I'm getting an error
When I run "$ npx prisma migrate dev --name init", the terminal returns "Error: Couldn't find a datasource in the schema.prisma file"
10 replies