Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Render Children into Other Dom Nodes with Portals

This is the second time you've used the expression hook, the first time to describe functions like ComponentDidRender().

The second to describe Portals as in this video. But are these the same thing as what people refer to as React Hooks? What are those?

1 Answer

Ben Slivinn
Ben Slivinn
10,156 Points

Portals:

A typical use case for portals is when a parent component has an overflow: hidden or z-index style, but you need the child to visually β€œbreak out” of its container. For example, dialogs, hover cards, and tooltips

Read More about React Portals

Hooks: Hooks are a new addition in React 16.8. They allow you to use State in functional components, so there is no need in class components anymore. Some benefits of hooks:

  1. State for functional components.
  2. Refs for functional components.
  3. No need for life-cycle methods. The new useEffect method provides the functionality of all the lifecycle methods together (all in one). Read More about React Hooks

Cheers!