[MST] Loading Data from the Server using lifecycle hook
2018-01-30 03:40
411 查看
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
In this lesson you will learn:
Set up basic data fetching
Leverage the
afterCreatelifecycle 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()) }) }))
相关文章推荐
- Simplest way to serve static data from outside the application server in a Java web application
- Android studio Declaring custom 'clean' task when using the standard Gradle lifecycle解决方法
- 102.You want to import schema objects of the HR user using Oracle Data Pump from the development dat
- [Falcor] Return the data from server
- Comet: Reverse Ajax for streaming data from the server
- Data transfer from GPIO port to RAM buffer using DMA upon receiving a trigger signal on the timer capture input channel.
- MS Bigdata HDInsight -Process, analyze, and gain new insights from big data using the power of Apache Hadoop
- Pushing data changes from the server to clients
- using sqlbulkcopy to quick load data from your client to sqlserver
- Got fatal error 1236 from master when reading data from binary log: 'A slave with the same server_uu
- [Angular] Using ngOnChanges lifeCycle hook to break object reference
- The Ex CS Grad Student: Running HQL from Python without using the Hive Standalone Server
- using INSTR function for obtaining data from a table, based on a selection from the master table (FK relation)
- Microsoft SQL Server 2008 R2 XML处理 One solution is to increase the number of characters retrieved from the server for XML data.
- Unable to Drop a Datafile From the Tablespace Using Alter Tablespace Command (Doc ID 1050261.1)
- Collecting performance counters and using SQL Server to analyze the data
- Which statement is true about loading data using the conventional path of SQL*Loader? A.Redo is not
- 转载:Character data is represented incorrectly when the code page of the client computer differs from the code page of the database in SQL Server 2005
- Using the TIME data type in SQL Server 2008
- Using SOAP Interface with the SQL Server Data Services