Browse Source

ref(js): Avoid import * as React for useState only (#34269)

Evan Purkhiser 2 years ago
parent
commit
257efcab9d
2 changed files with 4 additions and 4 deletions
  1. 2 2
      static/app/components/banner.tsx
  2. 2 2
      static/app/components/collapsePanel.tsx

+ 2 - 2
static/app/components/banner.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {useState} from 'react';
 import {css} from '@emotion/react';
 import styled from '@emotion/styled';
 
@@ -16,7 +16,7 @@ function dismissBanner(bannerKey: string) {
 
 function useDismissable(bannerKey: string) {
   const key = makeKey(bannerKey);
-  const [value, setValue] = React.useState(localStorage.getItem(key));
+  const [value, setValue] = useState(localStorage.getItem(key));
 
   const dismiss = () => {
     setValue('true');

+ 2 - 2
static/app/components/collapsePanel.tsx

@@ -1,4 +1,4 @@
-import * as React from 'react';
+import {useState} from 'react';
 import {css} from '@emotion/react';
 import styled from '@emotion/styled';
 
@@ -35,7 +35,7 @@ function CollapsePanel({
   collapseCount = COLLAPSE_COUNT,
   disableBorder = true,
 }: Props) {
-  const [isExpanded, setIsExpanded] = React.useState(false);
+  const [isExpanded, setIsExpanded] = useState(false);
   function expandResults() {
     setIsExpanded(true);
   }