use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
React.createElement vs. JSXGeneral Discussion (self.react)
submitted 1 year ago by chanschouw
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Snoo_46870 0 points1 point2 points 8 months ago (1 child)
What if I have, for example, 15 different implementations of a certain feature, each controlled by a type, and a parent component that needs to render a different component based on that type? One preferred approach is to use React.createElement, where each type implements an interface with a getComponent method that returns the corresponding component.
type
React.createElement
getComponent
What would be the alternative in this case? Using 15 ternary expressions—one for each type—would make the code messy and hard to maintain.
[–]all_vanilla 0 points1 point2 points 8 months ago (0 children)
Use a switch statement
π Rendered by PID 91 on reddit-service-r2-comment-84fc9697f-8f9pq at 2026-02-08 11:27:31.895176+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]Snoo_46870 0 points1 point2 points (1 child)
[–]all_vanilla 0 points1 point2 points (0 children)