I get `Invalid left-hand side in assignment expression.` when I assign a value.

I get the error above if I try to assign a value to selectedRate inside the onClick even with the arrow function removed, I still get an error.
const ratings = [1, 2, 3, 4, 5];

export default function Ratings() {
const [selectedRate, setSelectedRate] = createSignal(0);

return (
<form action="thank-you.html">
<ul class="rating-numbers flex">
<For each={ratings}>
{(rate) => <li onClick={() => setSelectedRate(selectedRate() = rate)}>{rate}</li>}
</For>
</ul>
</form>
// ...
const ratings = [1, 2, 3, 4, 5];

export default function Ratings() {
const [selectedRate, setSelectedRate] = createSignal(0);

return (
<form action="thank-you.html">
<ul class="rating-numbers flex">
<For each={ratings}>
{(rate) => <li onClick={() => setSelectedRate(selectedRate() = rate)}>{rate}</li>}
</For>
</ul>
</form>
// ...
1 Reply
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View