How to use the isValidElement function from react
Find comprehensive JavaScript react.isValidElement code examples handpicked from public code repositorys.
GitHub: sapegin/react-group
11 12 13 14 15 16 17 18 19 20
return children; } // Insert separators var separator = props.separator; var separatorIsElement = React.isValidElement(separator); var items = [children.shift()]; children.forEach(function(item, index) { if (separatorIsElement) { var key = 'separator-' + (item.key || index);
3
48
3
GitHub: rtsao/react-fp
42 43 44 45 46 47 48
} } function isRenderable(arg) { var type = typeof arg; return type === 'string' || type === 'number' || React.isValidElement(arg); }
0
8
1
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295
function isDOMComponent(inst) { return !!(inst && inst.nodeType === ELEMENT_NODE && inst.tagName); } function isDOMComponentElement(inst) { return !!(inst && React.isValidElement(inst) && !!inst.tagName); } function isCompositeComponent(inst) { if (isDOMComponent(inst)) {
0
0
1
+ 2 other calls in file
205 206 207 208 209 210 211 212 213 214
}, []); return [aniRef]; }; var isValidComponent = function isValidComponent(Component) { return React.isValidElement(Component) || jsutils.isFunc(Component); }; var renderFromType = function renderFromType(Element, props, Wrapper) { return isValidComponent(Element) ? jsutils.isFunc(Element) ? React__default.createElement(Element, props) : Element : jsutils.isArr(Element) ? Element : Wrapper ? React__default.createElement(Wrapper, props, Element) : Element;
0
0
0
react.default is the most popular function in react (505 examples)