HomeAbout

Why Functional React

Why Functional React?

Main problem with Mixin is that their implementations overlap by accident, but hooks cannot.

Easy to snowball complexity. Making existing components frail to modify.

  • name collision: two mixins cannot have identical method name (e.g. MixinOne.handleChange and MixinTwo.handleChange cannot be used together).
const myDataMixin = { getData: async() => { const response = await fetch('http://localhost:8000/api/data'); return await response.json() } } // class component React.createClass({ mixins: [myDataMixin], componentDidMount() { const data = this.getData(); } render() { // ... } })
AboutContact