Skip to content
Permalink
Browse files

feat: Use useCallback

  • Loading branch information...
atomita committed Oct 26, 2019
1 parent 9efb497 commit 18f289e31306bb9a9fc18915bbb5e7d478e2faab
Showing with 3 additions and 2 deletions.
  1. +3 −2 app/app.tsx
@@ -1,14 +1,15 @@
import React, { useState } from 'react';
import React, { useState, useCallback } from 'react';
import * as ReactDOM from 'react-dom';


function Application () {
const [cnt, setCnt] = useState(0)
const handleClick = useCallback(event => setCnt(cnt + 1))

return (
<div>
<div>
<button onClick={event => setCnt(cnt + 1)}>click</button>
<button onClick={handleClick}>click</button>
</div>
count: {cnt}
</div>

0 comments on commit 18f289e

Please sign in to comment.
You can’t perform that action at this time.