Using Provide and Inject in Vueby@smpnjn

Using Provide and Inject in Vue

tldt arrow
Read on Terminal Reader

Too Long; Didn't Read

It's easy in Vue to provide/give props or properties to a child element. If we want to pass data from a parent component to a grandchild, an easier way of doing this is with **provide**/**inject**. This lets us **Provide** data at a parent level, and **inject* it at any level below that. For example, we give our child element `PopularList` the property `name` and set it to `Most Popular Posts`. We can also make this property reactive, so it stays up to date in the grandchild element.
featured image - Using Provide and Inject in Vue
Johnny Simpson HackerNoon profile picture

@smpnjn

Johnny Simpson

About @smpnjn
LEARN MORE ABOUT @SMPNJN'S EXPERTISE AND PLACE ON THE INTERNET.
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa