Hacker News new | ask | show | jobs
by whstl 895 days ago
Off topic and unrelated to the discussion proper, but:

I really wish React had gone with "component factories" instead of `import ... from 'react'`.

This would not only allow for framework-agnostic components (so they could also work in Preact, Mithril, Inferno, etc, etc), it would also make the hooks implementation not dependent on global state.

For example:

    export default const Component = ({ createElement, useState }) => () => {
      ...
    }
Then you would only have to import from React from the entry point.