Environment Setup for React Hooks

InstructorElijah Manor

Share this video with your friends

Send Tweet

In this lesson, we’ll make sure we have a sufficient environment in order to start using the experimental Hooks API that comes with React. Currently you need a prerelease version of React since it hasn’t yet been introduced into an official release.

Daniel Miclos
~ 6 years ago

As a WebStorm user, I'm curious how do you open a browser preview inside VS Code?

Elijah Manorinstructor
~ 6 years ago

Thanks for watching the lesson. I'm not actually opening up a browse in VS Code. I'm using a feature of macOS that allows you to put two apps full-screen next to each-other in split-view https://support.apple.com/en-us/HT204948

~ 6 years ago

I keep getting TypeError: Object(...) is not a function errors on "02-add-state-to-a-react-function-component-with-the-useState-hook" from the github. the only change is that now react@next is 16.7.0(which is also the latest)

~ 6 years ago

also in "16.7.0-alpha.2"

~ 6 years ago

found it! need to configure it to "16.7.0-alpha.0 - next" vrsion

Elijah Manorinstructor
~ 6 years ago

Yes, at the time I recorded the lesson the next version owas 16.7.0-alpha.0, which is what is listed in the github omega branch. But, you should be able to follow the same instructions shown in the video by installing the following...

npm install react@next react-dom@next

React did launch an official 16.7.0 recently that does not have hooks baked-in (like they thought they would). This sort of messed up the whole next release schedule, but they now addressed it. You can now install the next version (like above) and it should still have the hooks code inside of it.

Roberto Alencar
~ 5 years ago

there's a little typo on the first command

current npm init react-app react-hooks && cd $

correct npm init react-app react-hooks && cd $_