Get started with immer CDN

MIT licensed

Immer is a produce-friendly state container for JS applications.

Tags:
  • immutable
  • mutable
  • copy-on-write

Stable version

Copied!

How to start using immer CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with immer CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/immer/10.0.4/cjs/immer.cjs.production.min.js"></script>
</head>
<body>
  <button id="update">Update</button>
  <script>
    const state = produce((draftState) => {
      draftState.counter = draftState.counter + 1;
    }, { counter: 0 });

    const button = document.getElementById('update');
    button.addEventListener('click', () => {
      const updatedState = produce(state, (draft) => {
        draft.counter += 1;
      });
      console.log('Updated state:', updatedState);
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions