在model中怎么同時發(fā)起多次請求,因為yield將異步請求轉(zhuǎn)為同步請求了,所以請求會按照同步順序依次執(zhí)行,使請求時間延長
錯誤寫法
// effects將按順序執(zhí)行const response = yield call(fetch, '/users');const res = yield call(fetch, '/roles');
正確寫法
// effects將會同步執(zhí)行 const [response, res] = yield [ call(fetch, '/users'), call(fetch, '/roles'), ]