azinit / learn-frontend

Study examples during learning and exploring last frontend tools, libs, solutions.
2 stars 0 forks source link

Learn more: react-context / props drilling / compound components #196

Closed azinit closed 4 years ago

azinit commented 4 years ago
azinit commented 4 years ago

Fun fact, there's nothing technically stopping you from writing your entire application as a single React Component. It can manage the state of your whole application and you'd have one giant render method... I am not advocating this though... Just something to think about :)

azinit commented 4 years ago

image

azinit commented 4 years ago

image

azinit commented 4 years ago

image

azinit commented 4 years ago

https://github.com/acl-services/paprika/wiki/React-SubComponent-Pattern https://www.youtube.com/watch?v=edW7rGz-QiM&list=PLPLlrF_vXpYaaweg3XLRE4cUWAAfficOA&index=27&t=3716s

image image

azinit commented 4 years ago

image

azinit commented 4 years ago

Порой - проще реализовать абстрактную струкутуру через Compound Components

azinit commented 4 years ago

More about compound components

azinit commented 4 years ago

image

azinit commented 4 years ago
azinit commented 4 years ago

Three articles about subcomponents

Part 1

https://blog.maximeheckel.com/posts/react-sub-components-513f6679abed

This kind of pattern is really beneficial:

Part 2

https://blog.maximeheckel.com/posts/react-sub-components-part-2-using-the-new-context-api-6f1c089acfe4

  • using Context

Part 3

https://blog.maximeheckel.com/posts/react-sub-components-part-3-whitelisting-sub-components-with-flow-b04f9bcf80c2

  • whitelist for children
azinit commented 4 years ago

Lib examples: