Posts tagged with javascript

Deep dive: How do React hooks really work?

www.netlify.com

Hooks is feature was added recently to React that I really like.

In this article, we reintroduce closures by building a tiny clone of React Hooks. This will serve two purposes – to demonstrate the effective use of closures, and to show how you can build a Hooks clone in just 29 lines of readable JS. Finally, we arrive at how Custom Hooks naturally arise.

Read more [www.netlify.com]

Join thousands of developers

Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.

No spam. Unsubscribe anytime. You can also follow me on X.

React for Vue developers

www.fullstackradio.com

In the latest episode of Full Stack Radio podcast, my colleague Seb explains the differences between React and Vue.

In this episode, Adam talks to Sebastian De Deyne about learning React from the perspective of a Vue developer, and how to translate all of the Vue features you're already comfortable with to React code.

Read more [www.fullstackradio.com]

Why I prefer React over Vue

sebastiandedeyne.com

My colleague Seb gives some good reasons why he personally likes working with React over Vue.

Vue is the default JavaScript framework for Laravel apps. Being part of the Laravel community, I often get the question why I prefer React, so I've decided to write down a few standout reasons.

Read more [sebastiandedeyne.com]

Optimizing JavaScript packages for tree shaking

madewithlove.be

In a new post at the madewithlove blog, Geoffrey Dhuyvetters explains how you can organize your code so a bundler can make it as small as possible.

As an author of (open source) packages, I think you have the responsibility to protect the bundle size of your package consumer. When you publish a package that exports a whole range of modules (for example lodash, ramda, date-fns…) you want to make sure the package is exported in such a way that the consumer of your package (mostly bundlers) can optimize size.

Read more [madewithlove.be]

Introducing Interia.js

reinink.ca

Jonathan Reinink is creating a library that'll make it easy to create server-driven single-page apps. Super cool idea!

I wanted to blend the best parts of classic server-side apps (routing, controllers, and ORM database access) with the best parts of single-page apps (JavaScript rendering and no full page reloads). Or, at least the best parts as I see them. ?

That journey has led me to a pretty interesting new pattern, which this article explains in detail. In short, I've created a Turbolinks inspired library that makes it super easy to create server-driven single-page apps. I am calling this library Inertia.js.

Read more [reinink.ca]

React as a UI Runtime

overreacted.io

In an impressive blog post on his blog, React lead developer Dan Abramov, explains how React works on the hood.

This is a deep dive — THIS IS NOT a beginner-friendly post. In this post, I’m describing most of the React programming model from first principles. I don’t explain how to use it — just how it works. It’s aimed at experienced programmers and folks working on other UI libraries who asked about some tradeoffs chosen in React. I hope you’ll find it useful!

React as a UI Runtime

Read more [overreacted.io]

Server-side apps with client-side rendering

reinink.ca

Jonathan Reinink proposes a new take on what Vue's role could be in a server rendered app.

What I have here is a classic server-side app, that uses server-side routing and controllers. There is no API. The controllers lookup the data from the database, and then pass it to the templates. Except, I'm not using any server-side (ie. Blade) templates. Instead I'm doing full client-side rendering using Vue.js. Confused yet? Let me explain.

Read more [reinink.ca]