react-react ·

Impressive state management toolkit for React
Pros
- Easy to use
- Easy to read and maintain
- Full hooks support
- React Server Components support
- Easy to get started with
- Fully compatible with React
- Small size
- Flow and TypeScript support
- 100% test coverage
Installation
yarn add react-react
or
npm install react-react
How to use
First, create a component:
import * as React from "react";
class MyComponent extends React.Component {
// ...existing code...
}
To set state, use the setState function. For example:
foo() {
this.setState({ bar: "value" })
}
Access the state via the state field:
render() {
return <div>{this.state.bar}</div>
}
To use the library, add the following import at the beginning of your file:
import "react-react";
Usage with hooks
Create a functional component:
import React, { useState } from 'react';
function MyComponent() {
// ...existing code...
}
Add the useState hook:
function MyComponent() {
const [value, setValue] = useState("value");
return <div>{value}</div>;
}
To update value, use setValue:
function foo(newValue) {
setValue(newValue);
}
Conclusion
Now you're ready to manage state like a pro! Happy coding!