Skip to content

Props & Component Composition

Props are a way to pass data from a parent component to a child component.
They are similar to function arguments in JavaScript.
They also work like HTML attributes.

Basic Props

Default Props

Advanced Props & Components Composition

Quy tắc:
Parent components QUẢN LÝ state top-down ở level gần nhất.
Modal không quan tâm đến quản lý state như thế nào, nó chỉ nên quan tâm đến việc mở hay đóng thôi.
Không để state hay fn ở modal, mà nên để ở parent
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.