Skip to content

Commit

Permalink
chore(docs): Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tihonove committed Jan 8, 2025
1 parent 45a4e53 commit f02057c
Showing 1 changed file with 28 additions and 25 deletions.
53 changes: 28 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# react-react · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/tihonove/react-react/blob/master/LICENSE) [![npm](https://img.shields.io/npm/v/react-react.svg?style=flat-square)](https://www.npmjs.com/package/react-react) [![Coveralls github](https://img.shields.io/coveralls/github/tihonove/react-react.svg?style=flat-square)](https://coveralls.io/github/tihonove/react-react) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/tihonove/react-react/pulls)


Impressive state management toolkit for react
Impressive state management toolkit for React 🚀

### Pros
* Easy to use
* Easy to read and maintain
* Full hooks support
* React Server Components support
* Low barrier to entry
* Full react compatible
* Small size
* Flow and Typescript support
* [100% test coverage](https://coveralls.io/github/tihonove/react-react)
* 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](https://coveralls.io/github/tihonove/react-react)

### Installation

Expand All @@ -28,63 +27,67 @@ npm install react-react

### How to use

First you should create component:
First, create a component:

```javascript
import * as React from "react";

class MyComponent extends React.Component {

// ...existing code...
}
```

To set state use `setState` function. For example
To set state, use the `setState` function. For example:

```javascript
foo() {
this.setState({ bar: "value" })
}
```

Access to state via `state` field:
Access the state via the `state` field:

```jsx
render() {
return <div>{this.state.bar}</div>
}
```

To use library just add following import to the beginning of you file:
To use the library, add the following import at the beginning of your file:

```javascript
import "react-react";
```

### Usage with hooks

Create a functional component
Create a functional component:

```jsx
import React from 'react'
import React, { useState } from 'react';

function MyComponent() {

// ...existing code...
}
```

Add `useState` hook
Add the `useState` hook:

```jsx
function MyComponent() {
const [value, setValueState] = useState("value")
return <div>{value}</div>
const [value, setValue] = useState("value");
return <div>{value}</div>;
}
```

To update `value` use `setValueState`
To update `value`, use `setValue`:

```jsx
function foo(value) {
setValueState(value)
function foo(newValue) {
setValue(newValue);
}
```

### Conclusion

Now you're ready to manage state like a pro! 🎉 Happy coding! 💻

0 comments on commit f02057c

Please sign in to comment.