Re-mount and children in solid-js #1150
-
Hello, react-developer here, have 2 questions:
const UserWidget = () => {
// ...
const userData = useUserData({userId});
// ...
return <UserForm key={userData.id} data={userData} />
} and haven't found anything like this in solid
when making layout components we can use something like this const LayoutManager = ({children} => {
// ...
return React.Children.map(children, child => {
if (child.type === Header) // ...
if (child.type === Content) // ...
if (child.type === Footer) // ...
})
}
// so usage will look like this:
<LayoutManager>
<Header />
<Content />
<Footer />
</LayoutManager> can we achieve something similar? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
const UserWidget = () => { return {userData => } Remember to pass the argument through so Show can differentiate it as a callback from an accessor.
Regardless this thread is probably relevant: #1141 |
Beta Was this translation helpful? Give feedback.
-
Hi, I know this is old. I was here for the "Remount" (1). But read about "Children Templates" question (2). And it looked awfully similar to a solution I wrote a blog post on: https://carlo.vercel.app/blog/how-to-dynamically-wrap-components-in-solidjs#so-how-do-we-do-it. Sharing, since it might be useful to check! Edit: Oh wait lol it's completely irrelevant. |
Beta Was this translation helpful? Give feedback.
<Show>
doubles as this when you use the callback formconst UserWidget = () => {
// ...
const userData = useUserData({userId});
// ...
return {userData => }
}
Remember to pass the argument through so Show can differentiate it as a callback from an accessor.
Regardless this thread is probably relevant: #1141