How to use the react-cosmos-shared2/fixtureState.updateFixtureStateProps 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-playground2 / src / plugins / ControlPanel / PropsState.tsx View on Github external
setFixtureState(fixtureState => {
      const fsProps = findFixtureStateProps(fixtureState, elementId);
      if (!fsProps) {
        console.warn(`Element id ${elementId} no longer exists`);
        return fixtureState;
      }

      const { values } = fsProps;
      return {
        ...fixtureState,
        props: updateFixtureStateProps({
          fixtureState,
          elementId,
          values: replaceOrAddItem(values, propVal => propVal.key === key, {
            serializable: true,
            key,
            stringified: value
          })
        })
      };
    });
  };
github react-cosmos / react-cosmos / packages / react-cosmos-playground2 / src / plugins / PropsPanel / PropsPanel.tsx View on Github external
setFixtureState(prevFs => {
      const fsProps = findFixtureStateProps(prevFs, elementId);
      if (!fsProps) {
        console.warn(`Element id ${elementId} no longer exists`);
        return prevFs;
      }

      return {
        ...prevFs,
        props: updateFixtureStateProps({
          fixtureState: prevFs,
          elementId,
          values
        })
      };
    });
  };
github react-cosmos / react-cosmos / packages / react-cosmos-fixture / src / FixtureCapture / props / index.ts View on Github external
setFixtureState(prevFs => ({
          ...prevFs,
          props: updateFixtureStateProps({
            fixtureState,
            elementId,
            values: createValues(childEl.props)
          })
        }));
      }