Skip to content

Commit

Permalink
improve instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed May 19, 2024
1 parent 37563e4 commit c79a80b
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions exercises/02.server-components/01.problem.rsc/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ const getGlobalLocation = () =>
window.location.pathname + window.location.search

const initialLocation = getGlobalLocation()
// 🐨 rename this to something more accurate like initialContentFetchPromise
const initialDataPromise = fetch(
// 🐨 replace /api with /rsc
`/api${initialLocation}`,
// 💣 we no longer accept application/json. Delete these headers
{ headers: { Accept: 'application/json' } },
)
// 🐨 rename initialDataPromise to something more accurate
// (💰 like initialContentFetchPromise)
// 🐨 also replace /api with /rsc
const initialDataPromise = fetch(`/api${initialLocation}`)
// 💣 we no longer process the response into JSON, instead react-server-dom-esm
// will process it for us. Delete this `then` call:
.then(r => (r.ok ? r.json() : Promise.reject(r)))
.then(r => r.json())

// 🐨 create a variable called initialContentPromise set to createFromFetch(initialContentFetchPromise)

Expand Down

0 comments on commit c79a80b

Please sign in to comment.