6. React+redux8
Hi guys, glad to see you again. Today we gonna talk about React. Some time ago it was updated and now we have changes in syntaxis. Let’s go.
At first, we should install Redux.
https://redux.js.org/introduction/getting-started
yarn add redux
yarn add redux-thunk
We we'll find out what redux-thunk is later.
When everything is installed, we should create the store. I`m creating a directory and file.
https://redux.js.org/usage/configuring-your-store
But here we can`t see easy way, and should find bits of code step by step.
We are creating RootReducer for all our Reducers. I understand, that we have only one reducer, but in future we can have many reducers.
Type for our RootReducer
Create store. RootReducer-we know. But what are applyMiddleware and thunk?
export let store = createStore(RootReducer,applyMiddleware(thunk))
Redux Thunk is used for API requests in Redux. And here we typed, that we will work with Thunk in Our Project.
One problem: Redux toolkit comes out instead of Redux and if you want to work with createStore, you should use legacy_createStore as createStore
import {AnyAction, applyMiddleware, combineReducers, legacy_createStore as createStore} from "redux";
Grab types from documentation:
https://redux.js.org/tutorials/typescript-quick-start
I`m tired, it`s a user unfriendly documentation, we are done with store.
Next step.
https://redux.js.org/usage/usage-with-typescript
Documentation tells us, that for useSelector and useDispatch hooks (these hooks work with Redux) we need to create a new folder. I`m creating a folder and grabbing code from the documentation
It helps us with type for these hooks.
And finally we gonna implement Redux in our project. Let’s have a look at Index, and wrap App with Provider.
Congratulations! We did it, but unfortunately, we can`t see our work in action. You will be able to see it in the next video. Finally we should push our project to GitHub, and check how it works in Heroku.
Ok.
You can see my code in GitHub under this video. Subscribe to my channel and invite all your friends. Next time we will see how Redux 8 works in our App. Keep in mind, that the man who couldn’t be a programmer has not been born yet.
links:
react-redux:https://yarnpkg.com/package/react-redux
GitHub:https://github.com/developeryudintsev/my-app
00:00 hi guys
00:23 we are instoling redux&redux-thunk
01:15 store
07:20 hooks
08:43 we are instoling react-redux
10:51 we are pushing our project in GitHub and Hroku
12:18 buy guys
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «6. React+redux8», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.