Fun little RSC experiment today...
Passing a pending db query into a client component. Kinda mind blowing you can pass promises over the network like this 😉
Using mjml + React to code emails is amazing.
Since your emails are React components you can render them anywhere in your app. Here's a little preview tool that shows me emails for recent purchases.
The first part of my tutorial on pagination w/ RSC has been published!
It still blows my mind you can read query params, use Prisma, and render Next's <Link> tag in a single component.
SSR + Suspense + Streaming!
I got SSR added to my RSC implementation and one of the coolest things is streaming just works.
Here's HTML being streamed down to the browser as the suspense boundaries resolve. Amazing that React gives you the APIs needed to build this:
Stole this idea from Remix: An <Await> component that suspends for a promise.
The nice thing about this is it lets me try out different loading UIs before extracting and naming a new component, defining its props, and declaring its types.
Here's the submit button I am using with my React Server Actions.
It uses `useFormStatus()`, a new experimental hook from React, to control the loading spinner.
This is how it works…
Stole this idea from Remix: An <Await> component that suspends for a promise.
The nice thing about this is it lets me try out different loading UIs before extracting and naming a new component, defining its props, and declaring its types.
Here's the search component. It's a client side input that starts a transition via the onChange event.
The transition adds the search term as a query param and then pushes the browser to that url:
Having a lot of fun with useFormState + server actions.
It's like a useReducer() where the state lives on the client and the action lives on the server.
I'm loving RSC. Makes writing a React app feel like something you'd see in PHP or Rails, but you also get the benefit of the world's best templating language 😉
What I find so cool about this approach:
- 50ish lines of code
- Fully interruptible
- `isPending` to know when a search is running
- No state, effects, or XHR requests
- No race conditions
- Sharable URL by default
Well look at that, server actions!
This is from and RSC implementation I've been working on. It feels like react is going to abstract away the whole client-server boundary over the next few years.
@adamwathan
I tried a whole bunch of markdown editors last month and ended up going with .
It was the easiest of all the editors to add custom behavior/config.
👀 Mirage.js in action with React and Jest!
Here's a little test to ensure the TodoApp on fetches its data from the server.
Also, I'm really digging react-testing-library
@kentcdodds
! Had a blast writing my first few tests with it today. 🤛
🧑🍳 Cooking up a little form made specifically for server actions.
Built-in validation, error handling, success messaging, and type safety – all derived from server side code.
I used
@gatsbyjs
this weekend for a new landing page. Really liked it!
* The on-boarding is fantastic, I never felt slowed down. I was able to ship to production the day I started.
* Neat how everything is queryable with graphql.
* The official plugins are a nice touch.
I did a teardown for the
#emberjs
home page. The goal of this is to help us understand who the home page is for and how to communicate that. I'm excited to keep pushing these ideas forward!
🔥 We've been using these
#emberjs
provider components as a way to decouple business logic from presentational logic.
The provider is responsible for business logic.
The ui-form is responsible for display logic.
My course on "Data fetching with React Server Components" is now complete!
Over the past six months I've had an absolute blast building Next.js applications with Server Components. It's some of the most fun I've had using React in recent years.
🔥 The best kept secret in Ember its discussion board!
Post on discuss if you ever need an answer to something Ember related.
The answers are high quality and there's a good chance a core team member with deep understanding of your question answers it.
Live reload and module refreshing working w/ RSC implementation.
When an RSC is edited it re-renders on the server.
When a client component is edited only that module is refreshed on the client.
Pretty happy with this!
I'm loving
#tailwindui
, everything about it makes my app look professional!
Not just the components, but the new colors, recommended Inter font, and form controls are so freakin good.
Ember's element modifiers are so 🔥🔥🔥!
Small thing I just added our EmberConf training next week...
Whenever {{stock.price}} changes the span highlights yellow for a second.
Just spent a few minutes playing around with tracked and Glimmer components in a new
#emberjs
app. This stuff is so cool!
1. State declared at top of file
2. Feels like JS (classes, class properties, getters, setters)
3. Getters only recompute when their dependents change 😍
Element modifiers in
#emberjs
are super fun to write.
They're a joy to use because...
1. There's no extra wrapping or ceremony to get them wired to HTML elements.
2. They get you working with the HTMLElement right away. No special abstractions.
I've been doing a bit of fastboot work lately, and I've found this `renderingContext` macro to be extremely helpful!
I've been removing "if (this.get('fastboot.isFastBoot')) {" from the codebase like it's my job! ✂️
(1) My biggest takeaway was how quickly Remix got me from a <form> to a database. I didn’t have to wire up a form library or write any onSubmit handlers that fire off data requests. Once I submitted my form the very next lines of code are talking to a database.
I ran into an issue writing an
#emberjs
test for a loading state. Originally, I was using mirage’s server timing, but this felt brittle and opened the door to race conditions.
I learned that mirage can return promises, giving the test full control over when the server responds.
I'm finding that search components are the best introduction to container components. Instead of providing structure or HTML, these container components only yield out building blocks for consumers.
In case you missed it, we're bringing Mirage.js to the wider js ecosystem! 🚀
Sign up here to follow our progress. We'll be sending out React examples, docs, and learning materials in the next month or so!
Just added comments to my app using
@AWSAmplify
's API auth rules.
Easy and declarative, couldn’t ask for anything more when writing authorization code.
This code I'm working on today reminds me how much I enjoy
#emberjs
templating. All JS frameworks push this idea of declarative rendering, but I don't think you can get more declarative than this snippet:
🔥 Need to compare how your UI behaves across two different branches?
🌴 Use git worktree to checkout the other branch. Now you can have both branches running at the same time!
If you wanted to show someone the power of
#emberjs
in 15m what would you show them? I don't think "app from scratch" is good here because Ember's strength is maintainability in 1-2yrs, not "hello world" in 15m. Folks w/ ember experience, I want to know what you would show off.
Last week I added authentication to a React app using
@AWSAmplify
This was hands down the fastest I've ever built anything auth related in a SPA. What use to take me days took minutes!
Video here:
I love software that delights, when it goes above and beyond when you don't expect it.
Today's delight: Running
@Cypress_io
in headless mode records a video of the test run's UI so you can see everything that happened.
I've been doing a bit of React lately and I gotta say I'm really grateful for all the things that Ember has taught me over the years.
It's nice to recognize patterns and see how to apply ideas like routing, services, and pre-wired components when working with a new SPA.
(10) That’s it! Here’s how I would have pitched Remix to myself last week:
"Ever feel like you had to give up server rendered architectures from Rails and PHP once you started writing React? Remix brings those architectures back to your React apps"
Integration is one of the trickiest parts of building web applications these days. Not because it's hard, but because it's where the unknown unknowns are discovered.
I just installed qunit-console-grouper by
@TobiasBieniek
for an
#emberjs
app I'm upgrading, it's amazing!
Super useful for tracking down deprecations and warnings.
I just learned about the `passwordrules` attribute on <input type=password>.
It's a way to signal your requirements to password managers that auto generate pw info.
Next.js and MDX are an absolute joy to work with.
Made this little remark plugin tonight that renders all markdown images using Next's <Image> component.
Oh, it automatically finds the image height and width too!
@samselikoff
Backend team built a find-single-record endpoint for the frontend, but the frontend team was relying on a find-all-and-filter endpoint. Worst part about this was the “backend team” and “frontend team” were the same person. Wait, it gets worse… that person was me.
I learned something new about Suspense and transitions: Suspense boundaries don’t re-show their fallbacks when transitioning if the key is the same.
(1) Suspense boundaries have keys (even if not specified by the developer).
(2) When transitioning to a new state, if the
Ember Data + JSON:API won’t serialize has many relationships when saving a record.
You can opt into has many relationship saving with this code, but there’s a good reason why Ember Data does not turn this on by default… 1/
package.json using json is wrong, it's too strict of a format for listing application's dependencies. I often want to leave comments to explain why a dependency/version is in the application, but cant.
Last time I worked on a node codebase testing involved a ton of callbacks. I've been getting back into node this week, and wow, async/await makes mocha+chai really fun!
This code is as readable as rspec! Love it.
Here's the server action. It takes FormData and makes sure the name is "alice":
Next up is the <FormWithState> component, it calls useFormState and uses the action result to update its state. It uses that state to display the form's status.
It's neat that useFormState has the
@saltcod
@_buildui
This is from a private project, but I'm thinking this would be a fun little demo project to build. I'll let you know if I publish anything open source :)
This is the first video in my memory leak series... I've learned a ton in the past few months diving into these profiler tools. Excited to make more of this content!
Cool
#emberjs
addon I just discovered: ember-bind-helper.
It works just like the action helper, but sets the context to the parent object instead of the calling template.
Super useful for actions that live elsewhere, like on services.
ESLint plugins are a great way to enforce architecture decisions within in app.
I just removed 37 async relationships from an app in about five minutes using:
Pretty good feeling knowing that my test suite wouldn't have passed had I forgot one.
Can anyone recommend a cloud database that's usable from client driven JS code.
I'm thinking something along the lines of firebase... what do you recommend!?
I've been using monorepos by default for every library I work on these days and I gotta say it's been working out better than expected.
I start off with something like this:
- packages/library
- packages/docs
- packages/test-app
No more npm linking or webpack aliases. Love it.
One thing about data fetching on the server is it feels like you "lose" the ability to do event driven data fetching.
However, with Next’s `router.refresh()` you can trigger a server side rerender, whenever you want, that refetches all your data.
Optimized the
@ember_map
recording setup today. Got the ring light off the tripod and instead mounted to an arm on the desk. Also added a remote control pan & tilt device under the camera!