Skip to content

Files

Latest commit

author
evdolgy
Dec 15, 2019
fe43f2c · Dec 15, 2019

History

History
28 lines (17 loc) · 1.54 KB

readme.md

File metadata and controls

28 lines (17 loc) · 1.54 KB

Exchanger

A storeon and react hooks playground.

Start

npm i && npm start

Tests

npm test

Description

It's a yet another currency exchange app to perform convertation between USD, EUR and GBP with realtime rates from api.ratesapi.io.

Details

The project uses storeon for state management. It's a lightweight (173 bytes) and simplified incarnation of FLUX pattern, which is more performant than redux and provides field-wide granularity of reactiveness upon state changes and works with react hooks 🔥.

The main component, called Exchanger, uses react hooks. The most significant part of that approach is using useStoreon hook which encapsulates all state-management stuff and provides us with dispatch function in order to perform state changes by dispatching actions.

In order to split currency-based logic from project itself and to make work with money values more clear and precise, I used the dinero.js library. It seemlessly integrates with currency rates feed and provides Fowler's money pattern interface to store and convert currency values.

As the project is based on react hooks, it uses react-testing-library instead of enzyme for component's behavioral test. There are a few tests to demostrate conception itself.