Skip to content

Commit

Permalink
examples: hot hooks examples
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Jun 2, 2019
1 parent 2450f25 commit 7d4402c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions examples/styled-components/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,21 @@ const Context = React.createContext();

const Hook = () => {
const [state, setState] = React.useState({ x: 2 });
React.useEffect(() => {
console.log('mount effected');
setState(state => ({
x: state.x + 1,
}));
}, []);

React.useEffect(
() =>
() => {
console.log('hot effected 0');
setState(state => ({
x: state.x + 1,
})),
[],
x: state.x + 0.1,
}));
},
['hot'],
);
return (
<div>
Expand Down

0 comments on commit 7d4402c

Please sign in to comment.