#For component not displaying values

6 messages · Page 1 of 1 (latest)

thorn fox
#

What am I doing wrong here??

import { For } from "solid-js";

const ratings = [1, 2, 3, 4, 5];

export default function Ratings() {
   return (
      <form action="thank-you.html">
        <For each={ratings}>
        {(rate) => {
        <div>
        <input type="radio" name="rating" id={rate} />
        <label for={rate}>{rate}</label>
         </div>;
         }}
    </For>
      </form>
    );
}
vernal shoal
#

function passed to For is not returning anything

#

you might want to use ts to remove such problems forever

thorn fox
#

I was supposed to use () after the (rate)=>. It works now

prisma tuskBOT
#

Thread was archived by Sparrõw. Anyone can send a message to unarchive it.

thorn fox