How to use the react-cosmos-shared2/react.areNodesEqual function in react-cosmos-shared2

To help you get started, we’ve selected a few react-cosmos-shared2 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 react-cosmos / react-cosmos / packages / react-cosmos-fixture / src / FixtureCapture / props / index.ts View on Github external
// Component fixture state can be provided before the fixture mounts (eg.
      // a previous snapshot of a fixture state or the current fixture state
      // from another renderer)
      if (!findFixtureStateProps(fixtureState, elementId)) {
        const componentName = getComponentName(childEl.type);
        setFixtureState(prevFs => ({
          ...prevFs,
          props: createFixtureStateProps({
            fixtureState: prevFs,
            elementId,
            values: createValues(childEl.props),
            componentName
          })
        }));
      } else if (
        !areNodesEqual(
          childEl,
          getElementAtPath(prevFixtureRef.current, elPath)
        )
      ) {
        setFixtureState(prevFs => ({
          ...prevFs,
          props: updateFixtureStateProps({
            fixtureState,
            elementId,
            values: createValues(childEl.props)
          })
        }));
      }
    });
  }, [
github react-cosmos / react-cosmos / packages / react-cosmos / src / dom / ErrorCatch.tsx View on Github external
function fixtureChanged(f1: React.ReactNode, f2: React.ReactNode) {
  return !areNodesEqual(f1, f2, true);
}
github react-cosmos / react-cosmos / packages / react-cosmos / src / domRenderer / ErrorCatch.tsx View on Github external
function fixtureChanged(f1: React.ReactNode, f2: React.ReactNode) {
  return !areNodesEqual(f1, f2);
}