博客
关于我
react项目中suepense的简单使用
阅读量:521 次
发布时间:2019-03-08

本文共 299 字,大约阅读时间需要 1 分钟。

import React, {   Components, Suspense} from 'react';

简单来说项目中组件加载需要耗时,在组件未完全渲染出来这一段时间,如果不管不问显然不是明智之举;可以在这段时间体现交互的过程,做一些组件加载完成前做的事,这有利于优化页面。

return (	
)

fallback可以接受react组件 --> 作为要在页面渲染完成之前展示的组件;

总结:Suspense可优化页面交互,增加占位符或者loading…这简化了我们考虑应用程序加载状态的方式

转载地址:http://ovanz.baihongyu.com/

你可能感兴趣的文章
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>