Skip to content

Commit

Permalink
:doc Improved usage/intro doc
Browse files Browse the repository at this point in the history
  • Loading branch information
myckhel committed Feb 21, 2022
1 parent 51216f2 commit 182a053
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions website/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ slug: /

## `Overview`
`use-redux-states` allows you to create redux states at runtime for your react components without creating static actions and reducers.
It was also designed to solve react's unnecessary re-render issue by using `useMemoSelector` api and to improve your app's performance.
It was also designed to stop react's components unnecessary re-render by using [useMemoSelector](./apis/hooks/use-memo-selector) api and to improve your app's performance.

## `Problems solved`
### **handles unnecessary selectors re-rendering**
Expand Down Expand Up @@ -44,7 +44,7 @@ But `use-redux-states` found a way to create redux state much easier and dynamic
```jsx
const Component = () => {
const {setState, getState} = useReduxState({
name: 'component_state',
path: 'component_state',
state: {
state1: 'one',
state2: 'two',
Expand Down
17 changes: 8 additions & 9 deletions website/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,17 @@ const Usage = () => {

const { locale, count } = useMemoSelector(selector)

const onChange = (e) => setState({locale: e.target.value})

const onClick = () =>
setState((prevState) => ({ ...prevState, count: count + 1 }))


return (
<div>
<h6>Current Count: {count}</h6>
<input
onChange={({ target: { value: locale } }) => setState({locale})}
value={locale}
/>
<button
onClick={() =>
setState((prevState) => ({ ...prevState, count: count + 1 }))
}
>
<input onChange={onChange} value={locale} />
<button onClick={onClick}>
Increment Count
</button>
</div>
Expand Down

0 comments on commit 182a053

Please sign in to comment.