invariant
can be replaced by lighter alternatives.
tiny-invariant
is a tiny, widely-supported, zero-dependency alternative to invariant
.
import invariant from 'tiny-invariant';
invariant(truthyValue, 'This should not throw!');
invariant(falsyValue, 'This will throw!');