#why can't I get my props `test` from getStaticPaths ?

3 messages · Page 1 of 1 (latest)

livid pivot
#
---
import Layout from "../../../layouts/Layout.astro"
import Card from "../../../components/Card.astro"

export async function getStaticPaths() {
    return [
        { params: { id: "1" }, props: { test: "1" } },
        { params: { id: "2" }, props: { test: "2" } },
        { params: { id: "3" }, props: { test: "3" } },
    ]
}

const { id } = Astro.params
const { test } = Astro.props
---
<Layout title="Welcome to Astro.">
    <main>
        <h1>Welcome to <span class="text-gradient">Astro</span></h1>
        <h2>id: {id}/{test}</h2>
warm fog
#

I think the code looks correct. Just to confirm,

  • The file is named [...id].astro?
livid pivot
#

I fixed it, I was proxying the page and the props where not passing from the proxy to the actual page