This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Block these pesky procrastinators | |
news.ycombinator.com | |
youtube.com | |
www.youtube.com | |
twitter.com | |
www.twitter.com | |
twimg.com | |
abs.twimg.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = () => { | |
const loadData = id => ({ id, value: 'some' }) | |
const [_, setDummy] = useState() | |
return ( | |
<div className="App"> | |
<button onClick={() => setDummy(Date.now())} /> | |
<SlowComponent | |
onClick={React.useCallback(() => loadData('dummy'), [])} | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = () => { | |
const loadData = id => ({ id, value: 'some' }) | |
const [_, setDummy] = useState() | |
return ( | |
<div className="App"> | |
<button onClick={() => setDummy(Date.now())}>Render</button> | |
<SlowComponent onClick={() => loadData('dummy')} /> | |
</div> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SlowComponent = React.memo(({ text, onClick }) => { | |
const arr = [] | |
for (var i = 1000000 - 1; i >= 0; i--) { | |
arr.push(i) | |
} | |
return ( | |
<div> | |
<div>I'm slow {text}</div> | |
<button onClick={onClick}/> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
adb reverse tcp:8097 tcp:8097 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://localhost:8097"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install -g react-devtools | |
react-devtools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
unstable_trace as trace, | |
unstable_wrap as wrap, | |
} from 'scheduler/tracing' | |
const useData = () => { | |
const [loading, setLoading] = useState(false) | |
const [data, setData] = useState(null) | |
const fetch = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
unstable_trace as trace, | |
unstable_wrap as wrap, | |
} from 'scheduler/tracing' | |
<button | |
onClick={() => | |
trace('Fetch data', performance.now(), () => { | |
setLoading(true) | |
fetchData() |
NewerOlder