When i try implementing the following code
const handleClick = (click) => {
let result = {};
const output = Object.keys(value)?.map((ele) => {
if (ele === click) result[ele] = true;
else result[ele] = false;
});
setValue(result);
};
getting this error. Please help me with it.
As the Optional Chaining operator is very new a lot of tooling doesn't support it. I would suggest updating your node version as well as running npm update
. You also might need to update your babel config to support the syntax.