码迷,mamicode.com
首页 > Windows程序 > 详细

对React核?api的研究

时间:2020-07-09 15:19:10      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:imp   you   ict   dea   fragment   deb   cto   bug   not   

 

   

const React = {
           Children: {
             map,
             forEach,
                count,
             toArray,
              only,
         },
           createRef,
Component,
PureComponent,
createContext,
forwardRef,
lazy,
memo,
useCallback,
useContext,
useEffect,
useImperativeHandle,
useDebugValue,
useLayoutEffect,
useMemo,
useReducer,
useRef,
useState,
Fragment: REACT_FRAGMENT_TYPE,
StrictMode: REACT_STRICT_MODE_TYPE,
Suspense: REACT_SUSPENSE_TYPE,
createElement: __DEV__ ? createElementWithValidation :
createElement,
cloneElement: __DEV__ ? cloneElementWithValidation :
cloneElement,
createFactory: __DEV__ ? createFactoryWithValidation :
createFactory,
isValidElement: isValidElement,
version: ReactVersion,
unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
unstable_Profiler: REACT_PROFILER_TYPE,开课吧web全栈工程师
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:
ReactSharedInternals,
};
// Note: some APIs are added with feature flags.
// Make sure that stable builds for open source
// don‘t modify the React object to avoid deopts.
// Also let‘s not expose their names in stable builds.
if (enableStableConcurrentModeAPIs) {
React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
React.Profiler = REACT_PROFILER_TYPE;
React.unstable_ConcurrentMode = undefined;
React.unstable_Profiler = undefined;
}
export default React;
核?精简后:
const React = {
createElement,
Component
}
react-dom 主要是render逻辑
最核?的api:
React.createElement:创建虚拟DOM
React.Component:实现?定义组件
ReactDOM.render:渲染真实DOM
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

  

对React核?api的研究

标签:imp   you   ict   dea   fragment   deb   cto   bug   not   

原文地址:https://www.cnblogs.com/zhouyideboke/p/13273580.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!