PerformanceLoggerContext.js 859 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @flow strict-local
  8. * @format
  9. */
  10. 'use strict';
  11. import * as React from 'react';
  12. import GlobalPerformanceLogger from './GlobalPerformanceLogger';
  13. import type {IPerformanceLogger} from './createPerformanceLogger';
  14. /**
  15. * This is a React Context that provides a scoped instance of IPerformanceLogger.
  16. * We wrap every <AppContainer /> with a Provider for this context so the logger
  17. * should be available in every component.
  18. * See React docs about using Context: https://reactjs.org/docs/context.html
  19. */
  20. const PerformanceLoggerContext: React.Context<IPerformanceLogger> = React.createContext(
  21. GlobalPerformanceLogger,
  22. );
  23. module.exports = PerformanceLoggerContext;