Should flux stores, or actions (or both) touch external services?

前端 未结 6 503
轮回少年
轮回少年 2020-11-28 00:49

Should the stores maintain their own state and have the ability to call network and data storage services in doing so ...in which case the actions are just dumb message pass

6条回答
  •  Happy的楠姐
    2020-11-28 01:20

    I tweeted this question to the devs at Facebook and the answer I got from Bill Fisher was:

    When responding to a user's interaction with the UI, I would make the async call in the action creator methods.

    But when you have a ticker or some other non-human driver, a call from the store works better.

    The important thing is to create an action in the error/success callback so data always originates with actions

提交回复
热议问题