Preserve reactivity in Solid example component (#5386)
This commit is contained in:
parent
df8092b007
commit
eab4a0279f
1 changed files with 2 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
import { createSignal } from 'solid-js';
|
import { createSignal } from 'solid-js';
|
||||||
import './Counter.css';
|
import './Counter.css';
|
||||||
|
|
||||||
export default function Counter({ children }) {
|
export default function Counter(props) {
|
||||||
const [count, setCount] = createSignal(0);
|
const [count, setCount] = createSignal(0);
|
||||||
const add = () => setCount(count() + 1);
|
const add = () => setCount(count() + 1);
|
||||||
const subtract = () => setCount(count() - 1);
|
const subtract = () => setCount(count() - 1);
|
||||||
|
@ -13,7 +13,7 @@ export default function Counter({ children }) {
|
||||||
<pre>{count()}</pre>
|
<pre>{count()}</pre>
|
||||||
<button onClick={add}>+</button>
|
<button onClick={add}>+</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="counter-message">{children}</div>
|
<div class="counter-message">{props.children}</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue