Skip to content

Lighthall level 1 challennge - click counter + location show for clicks

Javascript30/counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

COUNTER - SESL

Level 1 Challenge LightHouse SESL

A couter that increases when the button is clicked and does not revert to the initial count when the page is refreshed

Screenshot

Screenshot of the mockup

Link to live site:-

-Counter !!

Process

Used localstorage to ensure that the count state does not revert to 0 when the page is refreshed

const [count, setCount] = useState(localStorage.getItem("yourCount") || 0);

  useEffect(() => {
    localStorage.setItem("yourCount", count);
  }, [count]);

<button onClick={() => setCount((count) => JSON.parse(count) + 1)} > Click Here</button>

About

Lighthall level 1 challennge - click counter + location show for clicks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published