Closed EthanRBrown closed 6 years ago
Hi @EthanRBrown , this looks like the same problem at #37
please use version z@1.0.4 , and .call
method with the context variables, example:
matches(FOO).call({ FOO },
(x = FOO) => console.log('foo is foo!'),
(x) => console.log('foo is not foo???')
)
The problem is, the library can't have your context (with your decelerated const
) unless you explicitly pass as arguments. We need to update the docs with this .call
method, but honestly, I'm looking for an easier, or more elegant way to solve this problem.
I hope it works now!
Ah, thank you for the reply...I was remiss in that I searched the issues, but I didn't look through the closed issues. I agree a more elegant solution would be nice...might dig in & see if I can figure something out myself, will keep you posted if I can find the time. Thanks for all your hard work!
Using z in a Redux project, I was very surprised to find that
matches
doesn't work with atomic consts:This code results in "foo is not foo???", which is (ahem) not really what I was expecting.
I haven't dug into the source code to see how z works its magic, but it seems like this would be a really common use case.