Tell us what’s happening:
I have written the Powers setter function as it’s described. how It keep giving the same error message like:
You should use a ternary operator to check if “checked” is true. If it is, spread in the existing “powers” and “value” into an array. If it is not, filter out the “value” from "powers
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: index.jsx */
{/* User Editable Region */}
const handlePowersChange = e => {
const { value, checked } = e.target;
setPowers(powers => checked===true ? [...powers, value] : powers.filter(p => p !== value));
}
{/* User Editable Region */}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36
Challenge Information:
Build a Superhero Application Form - Step 18