5 ms·
Am I the only one who would rather write the following instead of JSX? Board.draw(game) or drawBoard(game)
by ScottFree 7y ago
Am I the only one who would rather write the following instead of JSX?
Board.draw(game)
or
drawBoard(game)
- hombre_fatal 7y agoNot sure how that's a preference without any further context about how you plan on writing the rest of the client. For all we know, both of those functions return <Board {game} />.
- ScottFree 7y ago> For all we know, both of those functions return <Board {game} />. No.
- hombre_fatal 7y agoWell, that's kind of my point. Making a superficial aesthetic change doesn't explain what you're actually preferring over JSX. Nor do you seem interested in explaining it.
- ScottFree 7y ago> Nor do you seem interested in explaining it. The lack of questions and the relentless downvoting makes me believe nobody's interested in hearing my explanations.
- mixedCase 7y agoWell you might like Hyperscript or Elm, those are two approaches that work quite well using simple function calls. The thing with JSX is introduces a syntax that is familiar to the rendered output (which is the status quo), and there's a relatively clear visual separation between the declarative and imperative parts; which is hard to enforce in pure JS.
- ScottFree 7y agoThe problem with JSX (and it's the same problem with all declarative languages) is you have no control over the control flow.
- mixedCase 7y agoThat's because JSX doesn't concern itself with control flow; it's not its job. Your framework has that job.
- ScottFree 7y agoNo, that's my job.
- vinceguidry 7y agoI'm struggling to think what kind of control flow you're looking for when specifying a document consisting of a tree of components. If all you want is a way to render one nodeset over a different nodeset at runtime then you can easily do that by setting that behavior in the relevant component.