poc: zustand state with mocking in playground #445
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this is a contrived, but working example of how we can achieve a few things:
views
package, along with callbacks for any user interactionsplayground
can pass in mock data very simply, with no dependence on zustand or any other state management librarygitness
can implement the same strongly-typed interface in a zustand store to implement encapsulated business logicHere's a real-world example of hwo complex a data store can get for a single page: https://github.com/harness/canary/pull/433/files#diff-5be8368c828f150a436361aa4a6c239c1e3febde07d493f85938a663ea3c6d3f
Passing ALL these values and methods as separate props could be very verbose.