Skip to content

Commit 659b6de

Browse files
authored
Merge pull request #12 from alevnyacow/feature/badges
badges and unicode smiles in readme (i guess it's still kinda cool)
2 parents c16e027 + 0b144e4 commit 659b6de

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,41 @@
1-
# <p align="center">Shared React variables</p>
1+
# Shared React variables
22

3-
Easy and comfortable React mutable state manager on hooks. It's extremely simple - you generate a hook in one line and then you can use it anywhere to operate with your state! Also you can have any number of such variables in your application.
3+
![npm](https://img.shields.io/npm/v/@alevnyacow/shared-react-variables)
4+
![GitHub](https://img.shields.io/github/license/alevnyacow/shared-react-variables)
5+
![GitHub last commit](https://img.shields.io/github/last-commit/alevnyacow/shared-react-variables)
6+
![npm](https://img.shields.io/npm/dm/@alevnyacow/shared-react-variables)
7+
![GitHub top language](https://img.shields.io/github/languages/top/alevnyacow/shared-react-variables)
8+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
49

5-
## <p align="center">1. Exported types</p>
10+
## **About**
11+
12+
Shared React variables provide you easy and comfortable mutable state management based on hooks. It's extremely simple - you generate a hook in one line and then you can use it anywhere to operate with your state! Also you can have any number of such state variables in your application.
13+
14+
## 🔍 **Exported types**
615

716
```ts
817
type ReactVariableHook<T> = (rerenderOnChange?: boolean) => T;
918
```
1019

11-
## <p align="center">2. API</p>
20+
## 📖 **API**
1221

1322
### <p align="center">createUseSharedVariable</p>
14-
#### **Description**
23+
#### Description
1524
Takes initial state as a parameter. Returns a hook can be imported and used anywhere in your application. When you use this hook, it returns you mutable global state. Whenever this state is changed component will be rerendered (this behaviour can be changed via *rerenderOnChange* flag in the hook).
1625

17-
#### **Signature**
26+
#### Signature
1827
```ts
1928
<T extends object>(initialState: T) => ReactVariableHook<T>;
2029
```
2130

22-
#### **Usage example**
31+
#### Usage example
2332
```ts
2433
// feel free to use this state hook anywhere!
2534
const useTimer = createUseSharedVariable({ ticks: 0 });
2635

2736
export { useTimer }
2837
```
2938

30-
## <p align="center">3. Package usage example</p>
39+
## 💡 **Package usage example**
3140

3241
https://codesandbox.io/s/react-shared-variables-example-f7feo7

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alevnyacow/shared-react-variables",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Easy and comfortable React state manager",
55
"main": "transpiled/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)