
If you've got any questions feel free to DM on Twitter @reillyjodonnell
Search for a command to run...

If you've got any questions feel free to DM on Twitter @reillyjodonnell
No comments yet. Be the first to comment.
Someone shared this image above. At first glance, I wasn’t sure about the perf implications — so let’s break it down from first principles :D Let’s deconstruct this monster Here’s the code: // Function to flatten React Context Providers. const flatte...

Intro Hello it’s me from the future! I originally was going to go over file based routing but pivoted to going over important SSR concepts with React / how Bun makes it easy. It’s full of struggles with hydration (mismatches), React entry points, and...

history? Serverless is EVERYWHERE and for good reason: nearly infinite scalability, physically closer to users, and pay-for-what-you-use pricing. But not without tradeoffs — vendor lock-in, (potentially) higher costs, and the infamous cold-starts. cf...

Powered by bash and AppleScript!

Sockets can only transmit binary (text.) Imagine we have this data const message = {id: '123', name: 'Reilly', message: 'Hey'} Here's the problem: we want to send this data to the ui but we have hundreds of useEffects spread throughout the codebase....

Don't let lingo like SSR/ CSR confuse you -- there's really just two major ways to serve HTML over an HTTP server in JS - either the server sends the HTML to the client (ssr) or the client generates the HTML for itself (csr/ spa) by using the Web API.
To demystify SSR we are going to look at the world's simplest dynamic SSR example:
// Let's create a server
import express from 'express';
const app = express();
function generateHTML() {
const date = new Date();
const localTime = date.toLocaleTimeString();
const localDate = date.toLocaleDateString();
const doc = `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Wow</title>
</head>
<body>
<span>Hello World!</span>
<span> The date is ${localDate}</span>
<span> It's currently: ${localTime} </span>
</body>
</html>
`;
return doc;
}
// Every get request to the '/' page will send the current date and time to the client
app.get('/', (req, res) => {
const doc = generateHTML();
res.send(doc);
});
const port = process?.env?.PORT ?? 3000;
app.listen(3000, () => {
console.log(`🚀 Live on http://localhost:${port}`);
});
That's it.