10.0.0-beta.6 • Published 9 months ago

x-plus v10.0.0-beta.6

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

x-plus (0.5kb gzipped)

Easy State Management

x-plus is a simple, small (0.5kb gzipped), fast state management library for react. x is used to create a store from an object with data and methods to get/set that data. useX is used inside a component to consume that state. it's well tested. and highly recommended for large complex applications.

Installation

To install x-plus, run:

npm install x-plus

Playground

https://stackblitz.com/edit/vitejs-vite-aj3kdd?file=src%2Fcreate.ts,src%2FApp.tsx&terminal=dev

Usage

import { useEffect } from "react";

import { x, useX } from "./create";

const state = x({
  count: 0,
  address: { street: { street1: "" }, emails: ["test@test.com"] },
  incr() {
    this.count++;
  },
  setStreet1(newStreet: string) {
    this.address = { ...this.address, street: { street1: newStreet } };
  },
});

function App() {
  const { count, incr, address, setStreet1 } = useX(state);

  useEffect(() => {
    console.log("address changed");
  }, [address?.street]);

  return (
    <>
      <button onClick={incr}>{count}</button> <br />
      <input
        type="text"
        value={address?.street?.street1}
        onChange={(e) => setStreet1(e.target.value)}
      />
    </>
  );
}

export default App;

Contributing

Contributions are always welcome! If you find a bug or want to add a feature, please open an issue or submit a pull request.

10.0.0-beta.2

9 months ago

10.0.0-beta.3

9 months ago

10.0.0-beta.1

9 months ago

10.0.0-beta.6

9 months ago

10.0.0-beta.4

9 months ago

10.0.0-beta.5

9 months ago

7.0.8

11 months ago

7.0.7

11 months ago

7.0.9

11 months ago

6.0.3

12 months ago

6.0.5

12 months ago

7.0.12

11 months ago

7.0.13

11 months ago

7.0.10

11 months ago

7.0.11

11 months ago

5.0.3

1 year ago

5.0.2

2 years ago

5.0.1

2 years ago

5.0.0

2 years ago

1.2.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

2.1.3

2 years ago

0.7.9

2 years ago

0.1.11

2 years ago

0.5.7

2 years ago

0.7.8

2 years ago

0.7.7

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.1

2 years ago

0.2.1

2 years ago

0.0.3

2 years ago

0.2.0

2 years ago

0.0.2

2 years ago

0.8.1

2 years ago

0.0.9

2 years ago

0.8.0

2 years ago

0.0.8

2 years ago

0.5.6

2 years ago

0.8.2

2 years ago

0.5.5

2 years ago

0.2.3

2 years ago

0.0.5

2 years ago

0.2.2

2 years ago

0.0.4

2 years ago

0.2.5

2 years ago

0.0.7

2 years ago

0.2.4

2 years ago

0.0.6

2 years ago

1.0.0

3 years ago