#How to mount and unmount solidjs component manually?

23 messages · Page 1 of 1 (latest)

icy falcon
#

How to mount and unmount solidjs component manually?

sly vault
#

createRoot but care to eloborate? should be simple to just use <Show/>

#
let dispose
let result = createRoot(d => {
  dispose = d
  return <Comp />
})
#

i'd bet there's some utility function in solid primitives

#

if you want to look

icy falcon
#

Here is the API, I want to use solidjs in such APIs.

sly vault
#

hmm, yeah, you can use above snippet then

#

is this kinda a vanilla-ish?

#

render would work too

sly vault
icy falcon
#

I'm developing obsidian plugin.

sly vault
#

how are currently mounting solid component?

icy falcon
#

It works now. Thank you!

sly vault
#

yeah, here's how with render

const dispose = render(() => <C />, node)
#

but yeah, you'd need a container as dispose wipes out the container iirc

icy falcon
#

yeah, it looks good to me. solid makes it easy to develop plugin UI.

sly vault
#

i wonder why i rarely see node.remove() when it comes to removing a node

sly vault
icy falcon
#

I'm not sure if solid will automatically remove node. I'll test it later.

sly vault
#

the code is correct, i'm saying node.parent.removeChild(node) vs node.remove()

warm lanternBOT
#

Thread was archived by YiiSh. Anyone can send a message to unarchive it.