Hacker News new | past | comments | ask | show | jobs | submit login

I agree that React's (and maybe other frameworks? I don't know them) conditional rendering syntax is very odd.

Like {my_bool && <Component />} instead of (if my_bool then <Component /> else null).

Or {my_bool || <Component />} (which is harder to express in most other languages because of Javascript considering truthy/falsy values instead of boolean true/false).

I am a fan of the UI-as-code approaches (as opposed to UI-as-markup or server-templating approaches) that React has though because of the other arguments you see in this thread, although the syntax could be better for React specifically. Elm is honestly pretty great in my opinion, and Flutter also has a nice language for describing UI as code. React just has less-than-optimal syntax.

I don't have a problem with map, though, except that I would like to extract the mapping function out of the "main view" into its own parameterised function that takes a list of whatever it needs.




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

Search: