Skip to content

Instantly share code, notes, and snippets.

@haoliangwu
Last active October 29, 2018 09:35
Show Gist options
  • Save haoliangwu/11f5bcd1bf389ad80d7970ecd716ff3a to your computer and use it in GitHub Desktop.
Save haoliangwu/11f5bcd1bf389ad80d7970ecd716ff3a to your computer and use it in GitHub Desktop.
advanced-mvvm-component-patterns
React Angular Vue
Build a Toggle Component 01 Build a Toggle Component Build a Toggle Component
Write Compound Components 02 Write Compound Components Write Compound Components
Make Compound React Components Flexible 02 Write Compound Components Write Compound Components
Make Enhanced React Components with Higher Order Components 03a Communicate Between Components Using Dependency Injection Make Enhanced Vue Components with Mixins
03b Enhance Components with Directives
Handling Prop Namespace Clashes with Higher Order Components 04 Avoid Namespace Clashes with Directives Replace mixin with slot
Improve Debuggability of Higher Order Components N/A N/A
Handle Ref Props with Higher Order Components 05 Handle Template Reference Variables with Directives Handle Element and Component reference with $refs
Improve Unit Testability of Higher Order Components N/A N/A
Handle Statics Properly with Higher Order Components N/A N/A
Use Render Props with React 06 Use <ng-template> Replace mixin with slot
Use Prop Collections with Render Props 07 Use Content Directives Enhance Content with Directive
Use Prop Getters with Render Props 08 Configure Content Directives Enhance Content with Directive
Use Component State Initializers 09 Use State Initializers Use State Initializers
Make Controlled React Components with Control Props 10 Use Control Inputs Use Control Props
Implement a React Context Provider 11 Compound Components with Services offical provide/inject solution
Implement a Higher Order Component with Render Props N/A N/A
Re-render Descendants Through shouldComponentUpdateFinish 12 Re-render Descendants Through ChangeDetectorRef N/A
Use Redux with Render Props 13 Use Ngrx with Directives N/A
N/A N/A Use Functional Component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment