Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not up to speed in JSX, how is it be better there? Don't one normally map over an array to loop? You cannot use for-loops inside JSX?

Or do you create an array of JSX-elements, like

    let elements=[]
    for (let i=0; i < 10; i++) {
      elements.push(<li key={i}>I'm number {i}</li>)
    }
    return <ol>{elements}</ol>;
Does not seem like an improvement to me.


It's just JS: You can do that, or you can use any helper method, or write your own helper. Can't really do that in Svelte.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: