Introduction
Overview​
- Typesafe, with helpful type inference
- Expressive API
- Supports predicates and not patterns for complex cases
- Tiny bundle footprint (
~7.4 kB
)
Status​
react-matchez is in the early stages of development, and there might be a few breaking changes here as I figure out how to:
- address some pattern matching principles (e.g. exhaustiveness)
- improve the overall type-safety
- simplify its API
- reduce its bundle size
Documentation​
Inspirations​
This library has been heavily inspired by:
ts-pattern: A great library by Gabriel Vergnaud that not only inspired the core and the APIs of
react-matchez
but is also used by our internals.Daggy: A great library from the Fantasy Land universe that brings sum types to JavaScript. Using its
taggedSum
andcata
methods, you can get really a really interesting taste of pattern matching.ECMAScript pattern matching proposal: This proposal briefly covers what the JSX syntax would look like. Even though
react-matchez
didn't quite use it as an inspiration, it was still an interesting reference.