Functional component: Definition

Eric Njanga Mar 06, 2018

Definition

A functional component is a JavaScript function that accepts a “props” object argument with data and returns a React element.

See the Pen React Functional Component by Eric Njanga (@ericnjanga) on CodePen.0

 

Usage

A functional component has limited features and is mostly used for:

  • Rendering purposes: It simply renders a React element
  • Mirroring purposes: via the “props” object, it mirrors the state of or runs the function of a parent element

 

Limitations

Functional components are the most basic definition of a React component. Such component cannot have a state or a lifecycle.

© 2018 Copyright Eric Njanga | |