Solution to what I had seen as a bug.
This commit is contained in:
parent
1548e81f13
commit
63e5076211
|
@ -1,6 +1,6 @@
|
||||||
/* @refresh reload */
|
/* @refresh reload */
|
||||||
import { render } from 'solid-js/web';
|
import { render } from 'solid-js/web';
|
||||||
import type { Component } from 'solid-js';
|
import { Component, createEffect, createSignal, onMount } from 'solid-js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Router,
|
Router,
|
||||||
|
@ -10,15 +10,19 @@ import {
|
||||||
useParams,
|
useParams,
|
||||||
useNavigate,
|
useNavigate,
|
||||||
hashIntegration,
|
hashIntegration,
|
||||||
|
useRouteData,
|
||||||
} from '@solidjs/router';
|
} from '@solidjs/router';
|
||||||
|
|
||||||
const Counter: Component = () => {
|
const Counter: Component = () => {
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const count = +params.count;
|
const [count, setCount] = createSignal(0);
|
||||||
|
createEffect(() => {
|
||||||
|
setCount(+params.count);
|
||||||
|
});
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<button onClick={() => navigate(`/counter/${count + 1}`)}>+1</button>
|
<button onClick={() => navigate(`/counter/${count() + 1}`)}>+1</button>
|
||||||
<div>Count: {count}</div>
|
<div>Count: {count}</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -32,10 +36,10 @@ const App: Component = () => {
|
||||||
</Routes>
|
</Routes>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
// source={hashIntegration()}
|
||||||
render(
|
render(
|
||||||
() => (
|
() => (
|
||||||
<Router source={hashIntegration()}>
|
<Router >
|
||||||
<App />
|
<App />
|
||||||
</Router>
|
</Router>
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue