Pass Data With a Callback Through React Context

InstructorDave Ceddia

Share this video with your friends

Send Tweet

A Context Provider can only accept a single value, but it can be of any type. When you need to pass multiple values through Context, group them into an object. Here we’ll learn how to pass data along with a callback function for updating the data, so that children will be able to update their parents.

Dave Ceddiainstructor
~ 5 years ago

Note: The 'before' code for this lesson is the code from the previous lesson.

Konekoya
~ 5 years ago

There's a typo in 01:04 transcript -> Provier should be Provider

Tobiah Rex
~ 5 years ago

What plugin (or something else) are you using to go to the Component Definition on click? I use Atom and the plugin I've used previously was goto-definition, however the project is deprecated. Would like something more reliable, with the additional underline before click. Thanks!

Dave Ceddiainstructor
~ 5 years ago

I'm using Visual Studio Code here, and I think it does this out of the box. The shortcut is Command-Click on a Mac.

Tobiah Rex
~ 5 years ago

I'm using Visual Studio Code here, and I think it does this out of the box. The shortcut is Command-Click on a Mac.

Ah, got it. Looks like i'll stick with what I've got for now then as Atom doesn't have that feature built-in. Thanks for the prompt reply. Awesome course btw!!

Hallya
~ 5 years ago

Hey Dave ! What extension or shortcut do you use to delete the whole expression by simply having cursor on it ?

Dave Ceddiainstructor
~ 5 years ago

@Hallya Not sure which spot you mean specifically, but I'm using vscode-vim and vim has some useful commands like ci{ to change the text inside braces, or ci" to change the text inside quotes. It might also be video editing 😄

Hallya
~ 5 years ago

@Dave like at 2:10, Ok cool, will check on vscode-vim to see what it can do :)