Skip to content

is there a way to enforce access to an atom via exports? #131

Answered by bowheart
joprice asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @joprice good question. There isn't currently any built-in way to prevent using the store directly.

perhaps wrap the atom somehow in a proxy that returns a store that throws when the get/set state calls are made

This wouldn't work since Zedux internally calls those methods on the store. I can't think of any way to do this currently besides crafting custom AtomInstance and AtomTemplate classes that overrides almost all the default behavior. That is possible, but pretty complex. It would take me several hours to put together at least, but I can see if I find time for it this week.

It would be about the same amount of work for me to add this as a full-fledged feature. I've been conside…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@joprice
Comment options

@bowheart
Comment options

@joprice
Comment options

Answer selected by joprice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants