react-is#isMemo JavaScript Examples
The following examples show how to use
react-is#isMemo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js From Path-Finding-Visualizer with MIT License | 6 votes |
function getStatics(component) {
// React v16.11 and below
if (isMemo(component)) {
return MEMO_STATICS;
}
// React v16.12 and above
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
Example #2
Source File: ref.js From the-eye-knows-the-garbage with MIT License | 6 votes |
export function supportRef(nodeOrComponent) {
var _type$prototype, _nodeOrComponent$prot;
var type = isMemo(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type; // Function component node
if (typeof type === 'function' && !((_type$prototype = type.prototype) === null || _type$prototype === void 0 ? void 0 : _type$prototype.render)) {
return false;
} // Class component
if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) === null || _nodeOrComponent$prot === void 0 ? void 0 : _nodeOrComponent$prot.render)) {
return false;
}
return true;
}
Example #3
Source File: index.js From spring-boot-ecommerce with Apache License 2.0 | 5 votes |
function getStatics(component) {
if (isMemo(component)) {
return MEMO_STATICS;
}
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}