React lets you use whatever style of data management you want, including mutation. However, if you can use immutable data in performance-critical parts of your application it's easy to implement a fast shouldComponentUpdate() method to significantly speed up your app. Dealing with immutable data in JavaScript is more difficult than in languages designed for it, like Clojure. However, we've provided a simple immutability helper, update(), that makes dealing with this type of data much easier, without fundamentally changing how your data is represented. You can also take a look at Facebook's Immutable.js and React’s Using Immutable Data Structures section for more detail on Immutable.js. You have no way of determining which data has changed since the previous copy has been overwritten. Instead, you need to create a new copy of myData and change only the parts of it that need to be changed.

Features

  • It's statically analyzable and it's not much more typing than the mutative version
  • Toggle a list of boolean fields from the target object
  • Instead of a command object, you can pass a function
  • Update a value based on its current one
  • Arrays can be indexed into with runtime variables via the ES2015 Computed Property Names feature
  • Autovivification, for the auto creation of new arrays and objects when needed

Project Samples

Project Activity

See All Activity >

License

MIT License

Follow immutability-helper

immutability-helper Web Site

You Might Also Like
Free CRM Software With Something for Everyone Icon
Free CRM Software With Something for Everyone

216,000+ customers in over 135 countries grow their businesses with HubSpot

Think CRM software is just about contact management? Think again. HubSpot CRM has free tools for everyone on your team, and it’s 100% free. Here’s how our free CRM solution makes your job easier.
Get free CRM
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of immutability-helper!

Additional Project Details

Programming Language

TypeScript

Related Categories

TypeScript Version Control Software, TypeScript Data Management System

Registered

2021-12-06