vuyisile.github.io

View on GitHub
14 March 2018

React Props Vs State

by {"name"=>"Vuyisile Weni"}

Stateful vs Stateless

Overview

what is a state?

A state is can object that is owned by the component where it is decleared. Its scope is limited to the current component, then that component can update its state whenever necessary if initialize.

A state is used for internal communication inside a component, and also a state of the parent component usually ends up being props of a child component, when the state is passed out of the current scope, it is refered to as prop.

what is a prop?

From what i have seen, a prop is read-only data because it is immutable (unchangable), I consider it as data that is parsed into a component, that component cannot change that property but can use that property.

tags: