import React from 'react' import {useDispatch, useSelector} from 'react-redux' import {AppStoreType} from './bll/store' import {loadingAC} from './bll/loadingReducer' import SuperButton from '../hw04/common/c2-SuperButton/SuperButton' import s2 from '../../s1-main/App.module.css' import {Loader} from './Loader' /* * 1 - в файле loadingReducer.ts дописать типы и логику * 2 - получить isLoading из редакса * 3 - дописать функцию setLoading * 4 - сделать стили в соответствии с дизайном * */ const HW10 = () => { // useSelector, useDispatch // пишет студент const isLoading = useSelector( (state: any) => state.loading.isLoading ) const dispatch = useDispatch() const setLoading = () => { // пишет студент // показать крутилку на 1,5 секунд // dispatch dispatch(loadingAC(true)) // setTimeout setTimeout(() => { dispatch(loadingAC(false)) }, 1500) } return (
Homework #10
{isLoading ? (
) : ( Set loading... )}
) } export default HW10