<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by David Chambers on Medium]]></title>
        <description><![CDATA[Stories by David Chambers on Medium]]></description>
        <link>https://medium.com/@david.chambers?source=rss-b968ff13a010------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ofMnS2v1pqvlLyRpfnZnog.jpeg</url>
            <title>Stories by David Chambers on Medium</title>
            <link>https://medium.com/@david.chambers?source=rss-b968ff13a010------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 16:18:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@david.chambers/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[JSX violates referential transparency]]></title>
            <link>https://medium.com/@david.chambers/jsx-violates-referential-transparency-83261aa2c2b2?source=rss-b968ff13a010------2</link>
            <guid isPermaLink="false">https://medium.com/p/83261aa2c2b2</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[David Chambers]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 19:45:03 GMT</pubDate>
            <atom:updated>2018-11-07T19:45:03.428Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve put my finger on what I most dislike about JSX: it violates <a href="https://en.wikipedia.org/wiki/Referential_transparency">referential transparency</a>.</p><p>We should be able to replace a variable with the expression we evaluated to determine its value. <em>f (y + z)</em> should be equivalent to <em>f (x)</em> if <em>x = y + z</em>.</p><p>This is not the case in JSX. Consider this code:</p><pre>const Foo = f (x);<br>return &lt;Foo bar={42} /&gt;;</pre><p>We cannot replace Foo with f (x).</p><p>Here’s the equivalent code written with <a href="https://reactjs.org/docs/react-api.html#createelement">React.createElement</a>:</p><pre>const Foo = f (x);<br>return React.createElement (Foo, {bar: 42});</pre><p>Obviously we can replace Foo with f (x) in this case:</p><pre>return React.createElement (f (x), {bar: 42});</pre><p>JSX is less expressive than the underlying JavaScript API. It violates an important property of functional programming, and highlights the inherent complexity of syntax.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83261aa2c2b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>