Search
Get Started
S
SolidJS
•
3y ago
gmnss1917
routeData arguments
How do I pass arguments from component props into a routeData function
(for data
-fetching with a key for example
)
?
SolidJS
Join
Solid is a declarative reactive Javascript library for creating user interfaces.
12,268
Members
View on Discord
Was this page helpful?
Yes
No
G
gmnss1917
OP
•
6/17/23, 3:30 PM
code in question
:
G
gmnss1917
OP
•
6/17/23, 3:30 PM
type GoalCardProps
=
{
goalId
: string
,
description
: string
,
deadline
: string
}
export function routeData
(
)
{
return createRouteData
(async
(
goalId
)
=
>
{
const response
= await pb
.collection
(
'milestones
'
)
.getFullList
(
{
filter
:
}
)
console
.log
(response
)
let milestones
: Goal
[
]
=
[
]
return
"milestones
"
}
)
}
export default function GoalCard
(props
: GoalCardProps
)
{
const milestones
= useRouteData
<typeof routeData
>
(
)
return
(
<div class
=
"text
-center text
-3xl
"
>
<span
>
<strong
>
{props
.description
}
<
/strong
>
<
/span
>
<span
>
|
{props
.deadline
}
<
/span
>
<input type
=
"checkbox
" class
=
"checkbox
"
/
>
<button class
=
"btn btn
-square
"
>
<svg xmlns
=
"
http://www.w3.org/2000/svg
" class
=
"h
-6 w
-6
" fill
=
"none
" viewBox
=
"0 0 24 24
" stroke
=
"currentColor
"
>
<path stroke
-linecap
=
"round
" stroke
-linejoin
=
"round
" stroke
-width
=
"2
" d
=
"M6 18L18 6M6 6l12 12
"
/
>
<
/svg
>
<
/button
>
<
/div
>
)
}
parent = "${*goalId*}"
parent = "${*goalId*}"