-
To me doing imports like this is cumbersome & frustrating for newbies: import { actions, createMachine, ...} from 'xstate'
const { after, cancel, choose, done, escalate, log, pure, raise, respond, start, stop } = actions I'd much rather not have to copy/paste the entire actions API (I won't remember where is commend is from), & have everything exported directly from xstate: import { actions, after, cancel, choose, done, escalate, log, pure, raise, respond, start, stop, createMachine, ...} from 'xstate' Maybe this is minor & not worth the change? Normally I would not complain, but since you're thinking of a v5 & changing some of the API anyhow, perhaps make importing a bit easier? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
What are your thoughts on using import { actions } from 'xstate';
// ...
entry: actions.forwardTo(/* ... */) // etc. Still too cumbersome? |
Beta Was this translation helpful? Give feedback.
-
I believe that we should stick to a single way of importing things.
import { actions } from 'xstate'
actions.assign(/* ... */)
import * as actions from 'xstate/actions'
actions.assign(/* ... */)
import { send } from 'xstate/actions'
send(/* ... */)
import { assign } from 'xstate'
assign(/* ... */) Personally, I would rank them in such order: 2 > 3 > 1 Note that I have also been maintaining a fairly popular project: redux-saga that comes with a very similar And also note that we plan to introduce some more entry points (like |
Beta Was this translation helpful? Give feedback.
I believe that we should stick to a single way of importing things.
actions
export:actions
exportPersonally, I would rank them in such order: 2 > 3 > 1
Note that I have also been maintaining a fairly popular project: redux-saga that comes with a very similar
redux-saga/effects
…