HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

How to implement cart in pure React? (useReducer and useContext hooks)

8,755 views October 30, 2020 25:23

Watch on YouTube
ChannelArtur Chmaro

Chapters

Description from the creator

In this video, you will learn how to read and write state from the #Context API. I will use #React #Hooks for that.
CODE: codesandbox.io/s/vibrant-wind-5gdt2

0:00:00 - Intro
0:02:30 - Context Provider
0:07:00 - reducer implementation
0:10:00 - read state from Context
0:13:00 - "ADD" action
0:15:00 - dispatch actions from components
0:18:00 - remove item from Cart
0:23:00 - calculate total price with reduce()

Blog: fullstak.pl/
Instagram: instagram.com/fullstak_pl/
Discord: discord.gg/Ft9nb4C
Twitter: twitter.com/ArtiChmaro

About this tutorial

Artur Chmaro published this 25:23 video tutorial on October 30, 2020. It has been watched 8,755 times on YouTube.

Duration
25:23
Published
October 30, 2020
Views
8,755
Likes
203

Tags

Share

This tutorial in other languages