When an app gets bigger, we’ll need to split the code into child components for reusability purposes.

Let’s see how to import a Child Component to a Parent Component with 3 simple steps.

Let’s say you have a folder structure like this:

/pages (parent)
/components (child)

Static Data

STEP 01: In the parent component, add a custom attribute when registering a child component.

<ChildComponent title="Raja Tamil"/>

STEP 02: Passing the title attribute to the props array as a single item will turn it to a property that can be used inside the child component instance.

export default {…

Raja Tamil

Instructor/Owner of SoftAuthor! http://softauthor.com/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store