Calculator with RN for Web @ FreeCodeCamp
A simple calculator Web app with FP logic core and React Native for Web UI.
Calculator was one of the Web development projects at FreeCodeCamp. I was strongly influenced by the ideas of functional programming from SICP book / course. Also I wanted to experiment with the idea that the logic of the app should not depend on a particular platform or View layer library. I've chosen to try React Native for Web but I wanted to logic to be independent from that decision.
Visually and feature-wise I liked the design and the features of the calculator by Google and wanted to make something similar.
There were no particular constraints on how to solve the task apart of that it should be a React Web app, so for the calculation itself I decided to use math.js which looked pretty strong esp. with the ability to parse a string with math expression. The only part that was left for the logic was to provide means for the user to construct this string safely without allowing the options which doesn't make sense as a math expression (like using 2 math operators one after another for example).
It's interesting that it was before React Hooks were introduced.This separate logic entity could be considered more or less as a movement in that direction. With React Hooks this logic can provide an additional hook interface to be consumed by React Component.