Skip to content

Commit f565b5b

Browse files
authored
Update tutorial commit and sandbox links (#256)
1 parent 7133e6a commit f565b5b

File tree

3 files changed

+47
-40
lines changed

3 files changed

+47
-40
lines changed

docs/tutorials/advanced-tutorial.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ The starting commit for this application is a plain React implementation that us
3333

3434
Let's start by viewing the original plain React app in action:
3535

36-
<iframe src="https://codesandbox.io/embed/rsk-github-issues-example-01-plain-react-nvmdy?fontsize=14&view=preview"
36+
<iframe src="https://codesandbox.io/embed/rsk-github-issues-example-8jf6d?fontsize=14&hidenavigation=1&theme=dark&view=preview"
3737
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
38-
title="rsk-github-issues-example-01-plain-react"
38+
title="rtk-github-issues-example-01-plain-react"
3939
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
4040
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
4141
></iframe>
@@ -57,15 +57,15 @@ The codebase is already laid out in a "feature folder" structure, The main piece
5757

5858
Since this app doesn't yet use Redux at all, the first step is to install Redux Toolkit and React-Redux. Since this is a TypeScript app, we'll also need to add `@types/react-redux` as well. Add those packages to the project via either Yarn or NPM.
5959

60-
> - [Add Redux Toolkit and React-Redux packages](https://github.com/reduxjs/rtk-github-issues-example/commit/83ae4753952060956a303a3aa983c8300facb974)
60+
> - [Add Redux Toolkit and React-Redux packages](https://github.com/reduxjs/rtk-github-issues-example/commit/05e5287453174598eece1ff17f8862b7e7fcaf08)
6161
6262
Next, we need to set up the usual pieces: a root reducer function, the Redux store, and the `<Provider>` to make that store available to our component tree.
6363

6464
In the process, we're going to set up "Hot Module Replacement" for our app. That way, whenever we make a change to the reducer logic or the component tree, Create-React-App will rebuild the app and swap the changed code into our running app, without having to completely refresh the page.
6565

6666
#### Creating the Root Reducer
6767

68-
> - [Add store and root reducer with reducer HMR](https://github.com/reduxjs/rtk-github-issues-example/commit/e80552e59e7832208c964ba1eefcfad24d41f317)
68+
> - [Add store and root reducer with reducer HMR](https://github.com/reduxjs/rtk-github-issues-example/commit/262fbe422c517388de26e6a53c1586b171c5b061)
6969
7070
First, we'll create the root reducer function. We don't have any slices yet, so it will just return an empty object.
7171

@@ -118,7 +118,7 @@ The `require('./rootReducer').default` looks a bit odd. That's because we're mix
118118

119119
Now that the store has been created, we can add it to the React component tree.
120120

121-
> - [Render Redux Provider with app HMR](https://github.com/reduxjs/rtk-github-issues-example/commit/647d4858da979d330a043fc629bd08a6bf21c23d)
121+
> - [Render Redux Provider with app HMR](https://github.com/reduxjs/rtk-github-issues-example/commit/df3c9b7279470a03feb2c6327c5a2fe951c8360c)
122122
123123
As with the root reducer, we can hot-reload the React component tree whenever a component file changes. The best way is to write a function that imports the `<App>` component and renders it, call that once on startup to show the React component tree as usual, and then reuse that function any time a component is changed.
124124

@@ -175,7 +175,7 @@ The first step is to look at the data that is currently being kept in `<App>`, a
175175

176176
Let's look at the source for the whole slice, and then break down what it's doing:
177177

178-
> - [Add initial state slice for UI display](https://github.com/reduxjs/rtk-github-issues-example/commit/daf082e161eaede49b48d92fdf8cb921ed80ea9b)
178+
> - [Add initial state slice for UI display](https://github.com/reduxjs/rtk-github-issues-example/commit/daeff01b1d1a022f89d7045570c2f8c79daf5c90)
179179
180180
**features/issuesDisplay/issuesDisplaySlice.ts**
181181

@@ -293,7 +293,7 @@ import { combineReducers } from '@reduxjs/toolkit'
293293

294294
Now that the issues display slice is hooked up to the store, we can update `<App>` to use that instead of its internal component state.
295295

296-
> - [Convert main issues display control to Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/e518e1936d5bdaeeb3cf3d6d0ac8496d12c1109b)
296+
> - [Convert main issues display control to Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/ca6b0085f068ce0c379998c46752b4e2e3688e61)
297297
298298
We need to make three groups of changes to the `App` component:
299299

@@ -380,9 +380,9 @@ Unlike typical `connect` + `mapDispatch` usage, here we call `dispatch()` direct
380380

381381
Let's see if this works!
382382

383-
<iframe src="https://codesandbox.io/embed/rsk-github-issues-example-8kex1?fontsize=14&module=%2Fsrc%2Fapp%2FApp.tsx&view=preview"
383+
<iframe src="https://codesandbox.io/embed/rtk-github-issues-example-02-issues-display-tdx2w?fontsize=14&hidenavigation=1&module=%2Fsrc%2Fapp%2FApp.tsx&theme=dark&view=preview"
384384
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
385-
title="rsk-github-issues-example-02-issues-display"
385+
title="rtk-github-issues-example-02-issues-display"
386386
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
387387
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
388388
></iframe>
@@ -527,7 +527,7 @@ Since the thunk middleware is already set up, we don't have to do any work there
527527

528528
Before we go any further, let's add a type declaration we can reuse instead.
529529

530-
> - [Add AppThunk type](https://github.com/reduxjs/rsk-github-issues-example/commit/8672da8c91a4b82a1bc29cfe24409e55e1f02928)
530+
> - [Add AppThunk type](https://github.com/reduxjs/rtk-github-issues-example/commit/9cdbe41d4c4a1ea6799d9542b1aa809670002094)
531531
532532
**app/store.ts**
533533

@@ -557,7 +557,7 @@ There are many cases where you would want different type settings here, but thes
557557

558558
Now that we have that type, we can write a slice of state for fetching details on a repo.
559559

560-
> - [Add a slice for storing repo details](https://github.com/reduxjs/rsk-github-issues-example/commit/061f8230b4e8f77664b023c17786a22e57f8ed3a)
560+
> - [Add a slice for storing repo details](https://github.com/reduxjs/rtk-github-issues-example/commit/b6bb2e2ff7952b1b8ada5da4ea7f40a6fc56b7c2)
561561
562562
**features/repoSearch/repoDetailsSlice.ts**
563563

@@ -660,7 +660,7 @@ For sake of simplicity, we'll stick with the logic as-is for the rest of the tut
660660

661661
Now that the repo details slice exists, we can use it in the `<IssuesListPage>` component.
662662

663-
> - [Update IssuesListPage to fetch repo details via Redux](https://github.com/reduxjs/rsk-github-issues-example/commit/efe41bcebb835e714e197a66c93998d02efaeab2)
663+
> - [Update IssuesListPage to fetch repo details via Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/74d4ff8b1da54db7eef586ad2515408bd4a88e96)
664664
665665
**features/issuesList/IssuesListPage.tsx**
666666

@@ -739,7 +739,7 @@ Inside our `useEffect`, we drop the `fetchIssueCount` function, and dispatch `fe
739739

740740
Next up, we need to replace the logic for fetching a list of open issues.
741741

742-
> - [Add a slice for tracking issues state](https://github.com/reduxjs/rtk-github-issues-example/commit/a358f4da20242a6213acdd71988f0f60d7a9a61e)
742+
> - [Add a slice for tracking issues state](https://github.com/reduxjs/rtk-github-issues-example/commit/4fa1bfffd787639f5f3d0dbab12758ccc851e293)
743743
744744
**features/issuesList/issuesSlice.ts**
745745

@@ -856,7 +856,7 @@ This slice is a bit longer, but it's the same basic approach as before: write th
856856

857857
Now we can finish converting the `<IssuesListPage>` component by swapping out the issues fetching logic.
858858

859-
> - [Update IssuesListPage to fetch issues data via Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/24a615f2ef5fbac793a4d0ea4163defd6ffd9222)
859+
> - [Update IssuesListPage to fetch issues data via Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/d3f4b39fa9edf9a89ab967c256494cd217984fb2)
860860
861861
Let's look at the changes.
862862

@@ -995,7 +995,7 @@ It's very similar to `<IssuesListPage>`. We store the current displayed `Issue`,
995995

996996
We conveniently already have the Redux logic for fetching a single issue - we wrote that already as part of `issuesSlice.ts`. So, we can immediately jump straight to using that here in `<IssueDetailsPage>`.
997997

998-
> - [Update IssueDetailsPage to fetch issue data via Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/fdd589dafa1ebb6b67a58d2f6a45c2be2ca54708)
998+
> - [Update IssueDetailsPage to fetch issue data via Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/52bdf2aa94e9a0dcd3ae8d54a48f0d968040b81e)
999999
10001000
**features/issueDetails/IssueDetailsPage.tsx**
10011001

@@ -1060,7 +1060,7 @@ Interestingly, there's actually a bit of a change in behavior here. The original
10601060

10611061
We have one more slice left to write - we need to fetch and store comments for the current issue.
10621062

1063-
> - [Add a slice for tracking comments data](https://github.com/reduxjs/rtk-github-issues-example/commit/002d92e75f76fcc8dffe9a4ba61f7c03d4ce2222)
1063+
> - [Add a slice for tracking comments data](https://github.com/reduxjs/rtk-github-issues-example/commit/2ee7670c3965ebb5cec7d946671ffa950997e0ae)
10641064
10651065
**features/issueDetails/commentsSlice.ts**
10661066

@@ -1132,7 +1132,7 @@ The slice should look pretty familiar at this point. Our main bit of state is a
11321132

11331133
The final step is to swap the comments fetching logic in `<IssueDetailsPage>`.
11341134

1135-
> - [Update IssueDetailsPage to fetch comments via Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/b9ec0600c98f875f0b331de335077f01a31e624d)
1135+
> - [Update IssueDetailsPage to fetch comments via Redux](https://github.com/reduxjs/rtk-github-issues-example/commit/5cc20e09893574c3115ceead530a6a295392449b)
11361136
11371137
**features/issueDetails/IssueDetailsPage.tsx**
11381138

@@ -1218,9 +1218,9 @@ Hopefully you now have a solid understand of how Redux Toolkit looks in a real w
12181218

12191219
Let's wrap this up with one more look at the complete source code and the running app:
12201220

1221-
<iframe src="https://codesandbox.io/embed/rsk-github-issues-example-8i4jn?fontsize=14&module=%2Fsrc%2Ffeatures%2FissueDetails%2FcommentsSlice.ts&view=editor"
1221+
<iframe src="https://codesandbox.io/embed/rtk-github-issues-example-03-final-ihttc?fontsize=14&hidenavigation=1&module=%2Fsrc%2Ffeatures%2FissueDetails%2FcommentsSlice.ts&theme=dark&view=editor"
12221222
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
1223-
title="rsk-github-issues-example-03-final"
1223+
title="rtk-github-issues-example03-final"
12241224
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
12251225
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
12261226
></iframe>

docs/tutorials/basic-tutorial.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ const counter = createReducer(0, {
191191
})
192192
```
193193

194-
To see the complete code so far, see [this CodeSandbox showing the use of `createAction` and `createReducer`](https://codesandbox.io/s/counter-vanilla-redux-starter-kit-sjouq).
194+
To see the complete code so far, see [this CodeSandbox showing the use of `createAction` and `createReducer`](https://codesandbox.io/s/counter-vanilla-redux-toolkit-sjouq).
195195

196196
### Introducing: `createSlice`
197197

@@ -274,6 +274,11 @@ You can see that we're keeping the async handling separate from the reducer logi
274274

275275
Here's the complete example in a sandbox:
276276

277-
<iframe src="https://codesandbox.io/embed/counter-vanilla-redux-starter-kit-6gkxx?fontsize=14&view=editor" title="counter-vanilla createSlice - Redux Starter Kit" allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media" style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;" sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"></iframe>
277+
<iframe src="https://codesandbox.io/embed/counter-vanilla-createslice-redux-toolkit-6gkxx?fontsize=14&hidenavigation=1&theme=dark&view=editor"
278+
style="width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;"
279+
title="counter-vanilla createSlice - Redux Toolkit"
280+
allow="geolocation; microphone; camera; midi; vr; accelerometer; gyroscope; payment; ambient-light-sensor; encrypted-media; usb"
281+
sandbox="allow-modals allow-forms allow-popups allow-scripts allow-same-origin"
282+
></iframe>
278283
279284
Now that you know the basics of each function, the next step is to try using them in a _slightly_ larger example to see more of how they work. We'll cover that in the [Intermediate Tutorial](./intermediate-tutorial.md).

0 commit comments

Comments
 (0)