How to use the react-addons-update function in react-addons-update

To help you get started, we’ve selected a few react-addons-update 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 edwardfhsiao / react-picky-date-time / src / js / PickyDateTime / Clock / index.js View on Github external
// debugger;
    if (!isNaN(newValue) && refName != 'meridiem') {
      let newDegree;
      if (refName == 'clockHandSecond') {
        newDegree = Number(newValue) * SECOND_DEGREE_NUMBER;
      }
      if (refName == 'clockHandMinute') {
        newDegree = Number(newValue) * MINUTE_DEGREE_NUMBER;
      }
      if (refName == 'clockHandHour') {
        if (Number(newValue) == 0) {
          newValue = 12;
        }
        newDegree = Number(newValue) * HOUR_DEGREE_NUMBER;
      }
      elObj = update(elObj, {
        value: { $set: newValue },
        degree: { $set: newDegree },
        startAngle: { $set: newDegree },
        angle: { $set: newDegree }
      });
      this.setState({ [refName]: elObj, slectionRange });
    }

    if (key == 'ArrowUp' || key == 'ArrowDown') {
      if (refName == 'meridiem') {
        let meridiem = 'AM';
        if (elObj == 'AM') {
          meridiem = 'PM';
        }
        elObj = meridiem;
        this.setState({ [refName]: elObj, slectionRange });
github pdaddyo / soundbounce-v2 / src / redux / modules / spotify.js View on Github external
const mergeTracks = ({state, tracks}) => {
	let existingTracks = state.tracks;
	const updateCommand = {};
	// don't want to overwrite tracks if already have more info
	for (let track of tracks) {
		if (existingTracks[track.id]) {
			track = {...existingTracks[track.id], ...track};
		}
		updateCommand[track.id] = {$set: track};
	}
	return {
		...state,
		tracks: update(state.tracks, updateCommand)
	};
};
github node-vision / node-react-xero-app / app / components / InvoiceUpdate.jsx View on Github external
addItem() {
    let newState = reactUpdate(this.state, {
      invoice: {
        items: {
          $push: [this.newItem]
        }
      },
      openDialogStandardActions: {$set: false}
    });

    this.setState(newState);

    this.newItem = {};
  }
github getheimdall / heimdall / heimdall-frontend / src / components / apis / SingleResource.js View on Github external
handleOperationPath(e) {
        const newState = update(this.state, { newOperation: {path: {$set: e.target.value}} })
        this.setState(newState)
    }
github leozdgao / taskbox / src / components / ScrollPanel / ScrollPanel.jsx View on Github external
_showScrollY () {
    this.setState({
      scrollYStyles: update(this.state.scrollYStyles, {
        display: { $set: 'block' },
        height: { $set: this._getScrollYHeight() }
      })
    })
  }
github appirio-tech / connect-app / src / projects / reducers / project.js View on Github external
function updateProductInPhases(phases, phaseId, productId, updateProduct, shouldReplace) {
  const phaseIdx = _.findIndex(phases, { id: phaseId })
  const productIdx = _.findIndex(phases[phaseIdx].products, { id: productId })

  const updatedProduct = shouldReplace ? updateProduct : update(
    phases[phaseIdx].products[productIdx],
    updateProduct
  )

  const updatedPhase = update(phases[phaseIdx], {
    products: { $splice: [[productIdx, 1, updatedProduct]] }
  })

  return update(phases, { $splice : [[phaseIdx, 1, updatedPhase]] })
}
github thegazelle-ad / gazelle-server / src / components / admin / ImageController.jsx View on Github external
deleteImagePreview(name) {
    const index = this.state.files.findIndex(
      fileObject => fileObject.metaData.name === name,
    );
    if (index !== -1) {
      const newFiles = update(this.state.files, { $splice: [[index, 1]] });
      this.safeSetState({
        files: newFiles,
      });
    }
  }
github gearz-lab / react-metaform / demo / components / LiveSchemaEditor.js View on Github external
onMainEntityNameChanged: function (event) {
        let updatedState = update(this.state, {entityName: {$set: event.value}});
        this.setState(updatedState, () => {
            if (this.state.autoUpdate) {
                this.resetMetaform();
            }
        });
    },
github node-vision / node-react-xero-app / app / components / InvoiceAdd.jsx View on Github external
_handleTotalTaxChange(e) {
    let newState = reactUpdate(this.state, {
      invoice: {
        totalTax: {$set: e.target.value}
      }
    });
    
    this.setState(newState);
  }
github RyanCCollins / corporate-dashboard / app / src / containers / DataViewContainer / reducer.js View on Github external
const currentFilter = (state = initialState.currentFilter, action) => {
  switch (action.type) {
    case SET_EMPLOYEE_FILTER:
      return update(state, {
        employee: {
          $set: action.employee,
        },
      });
    case SET_CUSTOMER_FILTER:
      return update(state, {
        customer: {
          $set: action.customer,
        },
      });
    default: return state;
  }
};

react-addons-update

>**Note:** >This is a legacy React addon, and is no longer maintained. > >We don't encourage using it in new code, but it exists for backwards compatibility. >The recommended migration path is to use [`immutability-helper`](https://github.com/kolodny/im

MIT
Latest version published 3 years ago

Package Health Score

78 / 100
Full package analysis

Popular react-addons-update functions