javascript ES6语法中的解构

时间:2016-09-08 13:28:34

标签: javascript

我在ES6 here中看到了这个例子(search.js的例子)。这种语法是什么意思?

感兴趣
import Api from '...'

完整示例

import { call, put } from 'redux-saga/effects'
import Api from '...'

// worker Saga: will be fired on USER_FETCH_REQUESTED actions
function* fetchUser(action) {
   try {
      const user = yield call(Api.fetchUser, action.payload.userId);
      yield put({type: "USER_FETCH_SUCCEEDED", user: user});
   } catch (e) {
      yield put({type: "USER_FETCH_FAILED", message: e.message});
   }
}

0 个答案:

没有答案
相关问题