UNPKG

293 BJavaScriptView Raw
1/**
2 * 输出 SSR 时需要的 state 字符串形式结果
3 * @param {Object} state
4 * @returns {string}
5 */
6const getSSRStateString = (state = {}) =>
7 `JSON.parse(` +
8 `decodeURIComponent("${encodeURIComponent(JSON.stringify(state))}"))`;
9
10module.exports = getSSRStateString;