Open
Description
Different frameworks are moving towards co-location of code that runs on the server and on the client. Some examples are React with "use server"
/"use client"
, Qwik with server$
, and Solid with server$
.
They all use functions, that can have confusing behaviors because they can close over variables "from the server to the client" and vice versa. Module expression would give a clear boundary:
// Rendered on server
function MyButton() {
return (
<button onClick={module {
// Running on client
export default () => alert("Clicked!");
}>
{fs.readFileSync("./btn-text")}
</button>
);
}
This might be another good use case for the shorthand syntax (#59)
(cc @ryansolid thanks for the idea!)
Metadata
Metadata
Assignees
Labels
No labels