ReactJS Tutorial for Beginners -7

React

Welcome to part-7 of the series. You can find part-6 here. We will first learn about passing data from children to parent component.

Methods as props

In react we generally pass data(or props) from parent component to child component. But if we want to pass props from Child to Parent component, we need to pass methods.

We will create a class based component ParentComponent inside components folder. It have a local state of parentName and a greetParent(), which will show an alert containing this state.

In the render part, we are simply calling a ChildComponent.

ParentComponent

You can read the rest of the article from my site. Link for the same is below.

https://thewebdev.tech/react-basics-7

This completes part-7 of the series. You can find part-8 here.

--

--

Nabendu Biswas

Architect, ReactJS & Ecosystem Expert, Youtuber, Blogger