@foo-x/react-tea
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

react-tea

The Elm Architecture for React.

The Elm Architecture · An Introduction to Elm

The differences from the original TEA are that:

  • it is applied to each component, not to the entire app.
    • This allows you to partially introduce the library to your app.
  • it can be combined with Hooks.

Why is it?

React has Hooks to manage states and side effects.
However, they are tightly coupled with view, which makes it difficult to test.
There is also the problem that useReducer cannot handle asynchronous code.

The advantages of TEA are that:

  • view and logic are separated, so they are easy to test.
  • "update" can handle asynchronous code.

This library also supports using Hooks, so you can leverage assets of custom hooks.

Installation

npm install @foo-x/react-tea

Documents

Examples

There is also an example of a test, which will show you how easy it is to test!

Snippets

Advance

If the logic of the component is only with Hooks, consider using react-container.

License

MIT

/@foo-x/react-tea/

    Package Sidebar

    Install

    npm i @foo-x/react-tea

    Weekly Downloads

    0

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    15.3 kB

    Total Files

    17

    Last publish

    Collaborators

    • foo-x