To change the background color using the onClick event in JSX, in the react JS we use the onClick event in the JSX, and pass a function instead of String, the function we pass in onClick event use naming camelcase convention.
The spread operator takes out the existing elements of the array and creates a new array after adding values.
To use the useState hook you need to import it into the component. It accepts variables, call-back functions, and an array to update the states.