How to use rax-is-valid-element - 1 common examples

To help you get started, we’ve selected a few rax-is-valid-element examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / rax / packages / rax-clone-element / src / index.js View on Github external
export default function cloneElement(element, config, ...children) {
  if (!isValidElement(element)) {
    throw Error('cloneElement: not a valid element.');
  }

  // Original props are copied
  const props = Object.assign({}, element.props);

  // Reserved names are extracted
  let key = element.key;
  let ref = element.ref;

  // Owner will be preserved, unless ref is overridden
  let owner = element._owner;

  if (config) {
    // Should reset ref and owner if has a new ref
    if (config.ref !== undefined) {

rax-is-valid-element

Rax isValidElement

BSD-3-Clause
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis

Popular rax-is-valid-element functions

Similar packages