Skip to content

Best practices: which is best 'helper functions' or actions/views/extent functions #2144

Discussion options

You must be logged in to vote

Hey @guigueb - this is an interesting question. I would probably lean towards the first solution. I think it's more conventional as far as MobX-State-Tree goes because it keeps your computed values in views, and keeps your actions in actions.

Another issue with solution two is that I don't think we recognize the getter syntax inside the actions block. I made a CodeSandbox with a similar code sample, and when I change my helper functions to get [funcitonName], I end up with a bunch of errors. Go ahead and fork that if you think you can make it work. I'd love to see a different approach, and it's always great to have code examples in these kinds of discussions.

Even if you could make the sy…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@guigueb
Comment options

@coolsoftwaretyler
Comment options

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