vigetlabs / microcosm

Flux with actions at center stage. Write optimistic updates, cancel requests, and track changes with ease.
http://code.viget.com/microcosm/
MIT License
487 stars 29 forks source link

microcosm-dom package #478

Closed nhunzaker closed 6 years ago

nhunzaker commented 6 years ago

This commit makes a single package for microcosm's preact and react bindings: microcosm-dom. This allows us to share nearly all of the code between these two rendering frameworks.

I'd like to share more of the tests, but that turned out to be pretty hard. If we did that, I'd probably use the Preact tests, which do not rely on enzyme (which I think is React only).

import { Presenter } from 'microcosm-dom/react'

React.render(<Presenter />, document.body)

// ...................

import { ActionButton } from 'microcosm-dom/preact'

Preact.render(<ActionButton>Click Me</ActionButton>, document.body)