[MST] Loading Data from the Server using lifecycle hook

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[MST] Loading Data from the Server using lifecycle hook相关的知识,希望对你有一定的参考价值。

Let‘s stop hardcoding our initial state and fetch it from the server instead.

In this lesson you will learn:

  • Set up basic data fetching
  • Leverage the afterCreate lifecycle hook to automatically run any setup logic a model instance needs to do after creation

 

export const Group = types
    .model({
        users: types.map(User)
    })
    .actions(self => ({
        // lifecycle hook
        afterCreate() {
            self.load()
        },
        load: flow(function* load() {
            const response = yield window.fetch(`http://localhost:3001/users`)
            applySnapshot(self.users, yield response.json())
        })
    }))

 

以上是关于[MST] Loading Data from the Server using lifecycle hook的主要内容,如果未能解决你的问题,请参考以下文章

Loading Data Into Hive From File By ODI 12c

Loading Data From File To Table By ODI 12c

使用OGG"Loading data from file to Replicat"的方法应该注意的问题:replicat进程是前台进程

[MST] Derive Information from Models Using Views

图论MST及拓展

Exception loading sessions from persistent storage