<?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 Linus Lewandowski on Medium]]></title>
        <description><![CDATA[Stories by Linus Lewandowski on Medium]]></description>
        <link>https://medium.com/@lew21?source=rss-beab75fe94c1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*x_g52CQyL5xwM0oqkc06Rg.jpeg</url>
            <title>Stories by Linus Lewandowski on Medium</title>
            <link>https://medium.com/@lew21?source=rss-beab75fe94c1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 17:21:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lew21/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[Why is React Server Actions model wrong?]]></title>
            <link>https://medium.com/@lew21/why-is-react-server-actions-model-wrong-2682834e7a32?source=rss-beab75fe94c1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2682834e7a32</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[rpc]]></category>
            <dc:creator><![CDATA[Linus Lewandowski]]></dc:creator>
            <pubDate>Sat, 21 Feb 2026 15:20:56 GMT</pubDate>
            <atom:updated>2026-02-21T15:20:56.737Z</atom:updated>
            <content:encoded><![CDATA[<p>Server functions, in practice, are server-side because they need to access some protected resources — like a database connection.</p><p>However — there is no explicit way to pass these resources to React server functions. All their arguments are passed directly from the client side.</p><p>The only way to access these is thru global context. And the <a href="https://softwareengineering.stackexchange.com/questions/148108/why-is-global-state-so-evil">global context is evil</a>. It introduces dependencies that cannot be tracked — not by the TypeScript checker, nor by programmers themselves without spending a lot of brain time on it. It makes your code not refactorable. It introduces unexpected errors in the future, when something changes, and the invariants you depended on are no longer true.</p><h3>But React has useContext and everything is fine?</h3><p>Yeah, sure. What’s the worst that can happen? The client app can crash, or show some stupid output.</p><p>And what if we run into unexpected behavior on the server? For example, we can wipe out the database. Or get hacked.</p><p>Actually, I was bitten tens of times by the React context magic in the client-side code. I really don’t want that on the server side.</p><h3>What would be the correct way?</h3><p>Obviously — use interfaces, as they were created to solve exactly this problem. The client app should depend on an interface, and the server app should contain a class implementing that interface. The RPC layer — should provide the client app a magic proxy object implementing the interface, that translates all the method calls to RPC calls to the server object.</p><p>This way — you can pass all the necessary resources to the server object thru the constructor. And on the client side — you can configure the connection to the server by instantiating the proxy object.</p><h3>What then?</h3><p>Just don’t use React Server Functions.</p><p>Either look for some well-designed RPC solution (good luck), or pay me to write a new one :P</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2682834e7a32" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>