Skip to content

Commit

Permalink
remove early references to react-error-boundary and improve instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Jun 20, 2024
1 parent 5f8bb41 commit d320074
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
7 changes: 2 additions & 5 deletions exercises/03.client-components/01.problem.loader/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ change to a form with an input which you can then submit and that will update
the name. We'll get to the actual implementation for updating later, but for now
we just need to get our client-side code for the edit state working.

🧝‍♂️ I've already updated the `importmap`
script in <InlineFile file="public/index.html" /> to handle bringing in
`react-error-boundary`. I've also
created <InlineFile file="server/rsc-loader.js" /> which you'll need to register
with Node.js as a loader for turning `'use client'` module exports into
🧝‍♂️ I've created <InlineFile file="server/rsc-loader.js" /> which you'll need to
register with Node.js as a loader for turning `'use client'` module exports into
reference registrations.

👨‍💼 Thanks Kellie. So now, what you need to do is register the loader, update the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"react": "https://esm.sh/[email protected]?pin=v126&dev",
"react-dom": "https://esm.sh/[email protected]?pin=v126&dev",
"react-dom/client": "https://esm.sh/[email protected]/client?pin=v126&dev",
"react-server-dom-esm/client": "https://esm.sh/@kentcdodds/[email protected]/client?pin=v126&dev",
"react-error-boundary": "https://esm.sh/[email protected]?pin=126&dev&[email protected]"
"react-server-dom-esm/client": "https://esm.sh/@kentcdodds/[email protected]/client?pin=v126&dev"
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"react": "https://esm.sh/[email protected]?pin=v126&dev",
"react-dom": "https://esm.sh/[email protected]?pin=v126&dev",
"react-dom/client": "https://esm.sh/[email protected]/client?pin=v126&dev",
"react-server-dom-esm/client": "https://esm.sh/@kentcdodds/[email protected]/client?pin=v126&dev",
"react-error-boundary": "https://esm.sh/[email protected]?pin=126&dev&[email protected]"
"react-server-dom-esm/client": "https://esm.sh/@kentcdodds/[email protected]/client?pin=v126&dev"
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ browser.
On the server-side, we need to tell `renderToPipeableStream` how to convert the
full-path file URL of our client modules into relative URLs the browser can use.
This will also allow `renderToPipeableStream` to warn us if any client modules
are imported outside of the proper base directory.
are imported outside of the proper base directory. So you need to pass the path
to the base directory of our client modules as the second argument to
`renderToPipeableStream`:

```js
renderToPipeableStream(h(App), moduleBasePath)
```

On the client-side, we need to tell `createFromFetch` how to convert the
relative path into a full URL for fetching the client module.

```js
createFromFetch(promise, { moduleBaseURL })
```

<callout-warning>
Because `react-server-dom-esm` is the one performing the dymamic import, all
imports will be relative to that module. On the client, we're loading it from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"react": "https://esm.sh/[email protected]?pin=v126&dev",
"react-dom": "https://esm.sh/[email protected]?pin=v126&dev",
"react-dom/client": "https://esm.sh/[email protected]/client?pin=v126&dev",
"react-server-dom-esm/client": "https://esm.sh/@kentcdodds/[email protected]/client?pin=v126&dev",
"react-error-boundary": "https://esm.sh/[email protected]?pin=126&dev&[email protected]"
"react-server-dom-esm/client": "https://esm.sh/@kentcdodds/[email protected]/client?pin=v126&dev"
}
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"react": "https://esm.sh/[email protected]?pin=v126&dev",
"react-dom": "https://esm.sh/[email protected]?pin=v126&dev",
"react-dom/client": "https://esm.sh/[email protected]/client?pin=v126&dev",
"react-server-dom-esm/client": "https://esm.sh/@kentcdodds/[email protected]/client?pin=v126&dev",
"react-error-boundary": "https://esm.sh/[email protected]?pin=126&dev&[email protected]"
"react-server-dom-esm/client": "https://esm.sh/@kentcdodds/[email protected]/client?pin=v126&dev"
}
}
</script>
Expand Down

0 comments on commit d320074

Please sign in to comment.