Skip to content

Commit

Permalink
fix: helper use_state_auto_clean
Browse files Browse the repository at this point in the history
  • Loading branch information
EqualMa committed Nov 9, 2021
1 parent 7b78bb2 commit 5d4475d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -12,7 +12,7 @@ Rust bindings for `React`.
`Cargo.toml`

```toml
react-sys = "1.0.0-alpha.10"
react-sys = "1.0.0-alpha.11"
```

Though the version is at `1.x-alpha`,
Expand Down
4 changes: 1 addition & 3 deletions helpers/use-state-import.js
Expand Up @@ -7,8 +7,6 @@ export function use_state_object(initial_value) {
export function use_state_auto_clean(initial_value, clean) {
const obj = use_state_object(initial_value);
const state = obj.value;
React.useEffect(() => {
clean(state);
}, [state]);
React.useEffect(() => () => void clean(state), [state]);
return obj;
}
4 changes: 1 addition & 3 deletions helpers/use-state.js
Expand Up @@ -5,8 +5,6 @@ export function use_state_object(initial_value) {
export function use_state_auto_clean(initial_value, clean) {
const obj = use_state_object(initial_value);
const state = obj.value;
React.useEffect(() => {
clean(state);
}, [state]);
React.useEffect(() => () => void clean(state), [state]);
return obj;
}

0 comments on commit 5d4475d

Please sign in to comment.