i have tried all i could, i could get a solution, i need my count value to remain, even if i refresh my page. for example if my count is up to 3, and when i refresh my browser, the 3 should remain and not start from zero.
can i get any help?? i am currently learning localstorage
here is the code
import React, { useState } from "react";
export default function LocalStorageSetting() {
const [count, setCount] = useState(0);
const handleClick = () => {
setCount((prevCount) => prevCount + 1);
};
localStorage.setItem("count", count);
return (
<div>
<button onClick={handleClick}>Increase</button>
<h1>{count}</h1>
</div>
);
}