Continuing in our exploration handling interactions and events in React, we'll now create a simple UI - but without <input> elements. In addition to learning how to handle click events, you'll also learn how to utilize SVGs in React apps.
- Scaffold the app using
npm create viteornpx create vite.
- Render the on.svg image from the icons directory and attach an onClick event listener to it.
- When the image is clicked, toggle it to the off.svg image - and vice versa. on -> off -> on -> off.