I am trying to build a movie app, I am exporting popular as a prop to a component but every time I run the console is saying popular is undefined what am I doing wrong? This is my code;
<script context="module">
export async function popularLoad({fetch}) {
const res = await fetch(`https://api.themoviedb.org/3/movie/popular?api_key=b2b2c2d249db772c4fec3e4b4ce753e1&language=en-US&page=1`);
const data = await res.json();
if (res.ok) {
return {
props: { popular: data.results }
};
}
}
</script>
<script>
import PopularMovies from "../components/PopularMovies.svelte";
export let popular;
</script>
<section>
<PopularMovies {popular}/>
</section>
I am trying to build a movie app, I am exporting popular as a prop to a component but every time I run the console is saying popular is undefined what am I doing wrong? This is my code;