Knowledge Maxxing
← Back to topic library
Dev MaxxingBeginnerReact60 sec

React component

A React component is a reusable function that describes a piece of user interface, returning what should be displayed based on its inputs and internal state.

Prerequisite: JavaScript function

What matters

Breaking an interface into components lets pieces of UI be built, tested, and reused independently, instead of managing one giant page as a single block.

Example

A 'Button' component might be reused across a whole app, each instance just given different text and a different click handler.

Common misconception

A React component is not the same as an HTML element; it is a piece of code that ultimately renders into HTML elements, but can contain logic and state.

Recall question

What benefit comes from breaking an interface into separate components?

Keywords and related concepts

React componentreusable UIcomponent-basedprops

Related topics

Props
Dev MaxxingBeginner
State
Dev MaxxingBeginner
JavaScript function
Dev MaxxingBeginner