Open rreusser opened 5 years ago
Interesting.. what do you still find confusing nowadays? What the hardest stuff to remember?
A lot of the trickiness is contained in this section:
state
is actually "field accessor" object that returns values when you query state.propname
rather than the field instance itself. With the exception of section. state.section
returns a field accessor object for that section.
The result is this:
state.propname
: returns a valuestate.$field.propname
: returns the field instance so that you can operate on itstate.sectionname
: returns a "field accessor" with properties defined so that…state.sectionname.propname
: returns a value. but of course what if we want the instance, so that…state.sectionname.$field.propname
: will return the field instanceThe goal was to make a very simple API for 95% of the use cases, which are just querying values. The downside is that I get a little turned around when navigating the internals.
The API works, but it's a bit confusing. I'd love to just rename everything (the internal APIs, really) a bit more consistently so that they're a bit easy and more natural to comprehend. I wrote it and I still struggle to remember how to navigate the hierarchy.