Closed ilhamfu closed 1 year ago
Duh I'm stupid...I COMPLETELY forgot to implement the update function because most of the time I use the $ syntax (which by the way I suggest you to use too)...you can just do this
<button class="grid place-items-center bg-white border-gray-600 shadow-md" on:click={() => {
$current_page = Math.max(($current_page ?? 1) - 1, 1)
}} > < </button>
Btw thanks for the issue, I'll implement the update function and republish again ;)
i can live with that. i use update because that makes me feel safe whenever i want to update a state based on its previous value
You don't have to...I just fixed it and I'm gonna republish soon.
Let me know if it's fixed in 0.1.14 😉
The issue should be fixed know, closing for the moment...feel free to comment back if there's some sort of problem, I'll re-open the issue eventually.
i notice this when i building my pagination component, i use this code
const current_page = queryParam("page", ssp.number(1));\
and using this button to go to previous page ` <button class="grid place-items-center bg-white border-gray-600 shadow-md" on:click={() => current_page.update((e) => { const new_val = Math.max((e ?? 1) - 1, 1); return new_val; })}