Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

[Feedback] Preserve JSX mode

$
0
0

Unlike React, Solid’s component functions only execute once on creation. Reactivity is done through a tracking context:

const [count, setCount] = createSignal(0)

<span>{count()}</span>

By calling count() inside of span, solid figures out that it needs to re-render <span> anytime that count changes

In @Fattafatta’s example, in the rescript code they put maybe() in between the <div>, which is correct, but the compiler put the maybe() function call outside of it in the output, thus calling the getter outside of the tracking scope

let m = maybe()

// not tracked
<div>{m}</div>

Viewing all articles
Browse latest Browse all 2592

Trending Articles