iyc_
Joined 4 karma
- iyc_ parentMistakenly read this as you wrote that 2D game engine (which looks awesome btw) for a job interview to get the job: "I can't compete with this!!! HOW CAN I COMPETE WITH THESE TYPES OF SUBMISSIONS!?!?! OH GAWD!!!"
- > In React, we render lists by using regular JavaScript idioms like loops, arrays, and array methods like map. However in Solid.js, much like traditional templating languages, we get a construct like <For> that reinvents a concept that's already in the language.
I had/have your bias, but from playing with it I found a couple things:
1) Like React, you can swap out the template feature for a function call (or subcomponent). e.g. instead of
you can use functions and loops:return ( <button...> ... </button> <For each={state.todos}> ... );
2) Even with my bias, I must admit I found the `<For...` syntax to be surprisingly easy to read and fast to eye-parse; much more so than other 'templating' (using your term) languages/macros/syntax I've used over the years.function displayTODOs<T>(todos: T[]): any { let arr: any[] = []; for(let [i, todo] of todos.entries()) { const { done, title } = todo; let elem = (/\* JSX \*/); arr.push(elem); } return arr; } ... return ( <button ...> </button> {displayTODOs(state.todos)} );