Admittedly, we didn’t say this out loud
React’s JSX: The Other Side of the Coin
Cory House
51919

We didn’t say this out loud because of a misplaced mental mapping. The logic goes:

  1. Presentation and data/logic should be separate
  2. Presentation = HTML+CSS, data/logic = JavaScript
  3. Ergo HTML and JS should be separate

The flaw here is in step 2. Presentation actually = HTML+CSS+JavaScript. Presentation includes behavior and behavior requires JS.

Step 1 is still true, which is why we have a little shudder when we see presentation concerns (HTML) sitting in the middle of what might seem to be a business logic module (JS) - this reminds us of the bad old days of Classic ASP, JSP and the like, where we were compiling HTML on the server to be sent down to non-ajaxified browsers.

To get over this shudder we need to distinguish between presentational JS and data/logic oriented JS. Presentation vs logic separation is good. But this doesn’t map 1:1 to an HTML vs JS separation.

Show your support

Clapping shows how much you appreciated Mark Chitty’s story.