3.1.8 • Published 6 months ago

state-range v3.1.8

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

State Range

state-range is a very powerfull react state management system library. you can use it with your big application.

How to use

usersHandler.js

import {Store} from 'state-range'
class Users extends Store{
    ...
}

export default new Users

UserList.jsx

import {withStore} from 'state-range'
import Users from 'usersHandler'

const UserList = () => {
    const items = Users.getAll()
    return (
        <ul>
            {
                items.map(item => ...)
            }
        </ul>
    )
}
export default withStore(UserList)
import {Store, withStore} from 'state-range'
import UserList from 'UserList'
import User from 'usersHandler'

const App = () => {
    return(
        <div>
            <UserList />
            <button onClick={() => {
                User.insert({
                    name: "",
                    email: ""
                })
            }}>Add Item</button>
        </div>
    )
}

Methods

import User from 'usersHandler'
const users = User.find({name: "nax"})

// with query method
const users = User.find({email: "$startWith(nax@)"})

// search
const users = User.find({email: "$search(nax)"})

Query Methods

NameDescriptionUse
equal$equal()- this is default method{name: "$equal(abc)"}
notEqual$notEqual(){name: "$notEqual(abc)"}
startWith$startWith(){name: "$startWith(abc)"}
endWith$endWith(){name: "$endWith(abc)"}
hasValue$hasValue(){name: "$hasValue()"}
search$search(){name: "$search(abc)"}

withStore

you can pass two args in this function. first is your component and the second is callback. in that callback you need to return an array

import {withStore} from 'state-range'

withStore(Comp, () => {
    return [...]
})

withMemo

you can memoize your component. you can pass two args in this function. first is your component and the second is callback. in that callback you need to return an array

import {withMemo} from 'state-range'

withMemo(Comp, () => {
    return [...]
})
3.1.8

6 months ago

3.1.7

6 months ago

3.1.6

7 months ago

3.1.5

7 months ago

3.1.4

7 months ago

3.1.3

10 months ago

3.1.2

10 months ago

3.1.1

10 months ago

3.1.0

10 months ago

3.0.1

1 year ago

3.0.0

1 year ago

1.8.2

2 years ago

1.9.0

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.4

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.8.3

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.7.1

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

0.2.7

2 years ago

0.2.8

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago