Skip to content

Commit

Permalink
feat: enables airbnb/hooks (#33)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: enables airbnb/hooks
  • Loading branch information
toshi-toma authored Mar 24, 2020
1 parent 86703f6 commit 3758eb0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
},
extends: [
"airbnb",
"airbnb/hooks",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/react",
Expand Down
16 changes: 15 additions & 1 deletion test/sample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,21 @@ const ComponentWithProps: FC<Props> = ({ name, age }) => (
</p>
);

const ComponentWithHooks = () => {
const [count, setCount] = React.useState(0);
React.useEffect(() => {
const n = count + 1;
setCount(n);
}, [count]);
return (
<button type="button" onClick={() => setCount(count + 1)}>
{count}
</button>
);
};

export default {
Component,
ComponentWithProps
ComponentWithProps,
ComponentWithHooks
};

0 comments on commit 3758eb0

Please sign in to comment.