mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
30 lines
698 B
JavaScript
30 lines
698 B
JavaScript
// @flow
|
|
|
|
import React, { useCallback, useContext } from 'react';
|
|
import Button from '../Button';
|
|
import ButtonIcon from '../ButtonIcon';
|
|
import { BridgeContext, StoreContext } from '../context';
|
|
|
|
export default function ReloadAndProfileButton() {
|
|
const bridge = useContext(BridgeContext);
|
|
const store = useContext(StoreContext);
|
|
|
|
const reloadAndProfile = useCallback(() => bridge.send('reloadAndProfile'), [
|
|
bridge,
|
|
]);
|
|
|
|
if (!store.supportsReloadAndProfile) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
disabled={!store.supportsProfiling}
|
|
onClick={reloadAndProfile}
|
|
title="Reload and start profiling"
|
|
>
|
|
<ButtonIcon type="reload" />
|
|
</Button>
|
|
);
|
|
}
|