Skip to content

Commit 259892d

Browse files
authored
Merge pull request #4583 from sunil-sharma-999/master
2 parents 843b650 + f5038be commit 259892d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/tutorials/quick-start.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ This creates a Redux store, and also automatically configure the Redux DevTools
6868
6969
Once the store is created, we can make it available to our React components by putting a React-Redux `<Provider>` around our application in `src/index.js`. Import the Redux store we just created, put a `<Provider>` around your `<App>`, and pass the store as a prop:
7070
71-
```ts title="index.js"
71+
```ts title="index.ts"
7272
// file: App.tsx noEmit
7373
import React from 'react'
7474
export default function App() {
@@ -109,7 +109,7 @@ Creating a slice requires a string name to identify the slice, an initial state
109109

110110
Redux requires that [we write all state updates immutably, by making copies of data and updating the copies](https://redux.js.org/tutorials/fundamentals/part-2-concepts-data-flow#immutability). However, Redux Toolkit's `createSlice` and `createReducer` APIs use [Immer](https://immerjs.github.io/immer/) inside to allow us to [write "mutating" update logic that becomes correct immutable updates](https://redux.js.org/tutorials/fundamentals/part-8-modern-redux#immutable-updates-with-immer).
111111

112-
```ts title="features/counter/counterSlice.js"
112+
```ts title="features/counter/counterSlice.ts"
113113
import { createSlice } from '@reduxjs/toolkit'
114114
import type { PayloadAction } from '@reduxjs/toolkit'
115115

@@ -151,7 +151,7 @@ export default counterSlice.reducer
151151

152152
Next, we need to import the reducer function from the counter slice and add it to our store. By defining a field inside the `reducer` parameter, we tell the store to use this slice reducer function to handle all updates to that state.
153153

154-
```ts title="app/store.js"
154+
```ts title="app/store.ts"
155155
// file: features/counter/counterSlice.ts noEmit
156156
import { createSlice } from '@reduxjs/toolkit'
157157

@@ -185,7 +185,7 @@ export type AppDispatch = typeof store.dispatch
185185
186186
Now we can use the React-Redux hooks to let React components interact with the Redux store. We can read data from the store with `useSelector`, and dispatch actions using `useDispatch`. Create a `src/features/counter/Counter.js` file with a `<Counter>` component inside, then import that component into `App.js` and render it inside of `<App>`.
187187
188-
```ts title="features/counter/Counter.js"
188+
```ts title="features/counter/Counter.ts"
189189
// file: features/counter/counterSlice.ts noEmit
190190
import { createSlice } from '@reduxjs/toolkit'
191191
const counterSlice = createSlice({

0 commit comments

Comments
 (0)