1- import React , { useContext , useRef , useState } from 'react' ;
2- import ReactDOM from 'react-dom' ;
1+ import React , { Children , Fragment , useContext , useRef , useState } from 'react' ;
2+ import { createPortal } from 'react-dom' ;
33import { ArrowDown , Clipboard } from 'react-feather' ;
44import { usePopper } from 'react-popper' ;
55import styled from '@emotion/styled' ;
@@ -14,7 +14,7 @@ import CodeContext from './codeContext';
1414const KEYWORDS_REGEX = / \b _ _ _ (?: ( [ A - Z _ ] [ A - Z 0 - 9 _ ] * ) \. ) ? ( [ A - Z _ ] [ A - Z 0 - 9 _ ] * ) _ _ _ \b / g;
1515
1616function makeKeywordsClickable ( children : React . ReactChildren ) {
17- const items = React . Children . toArray ( children ) ;
17+ const items = Children . toArray ( children ) ;
1818
1919 KEYWORDS_REGEX . lastIndex = 0 ;
2020
@@ -102,7 +102,7 @@ function KeywordSelector({keyword, group, index}: KeywordSelectorProps) {
102102 const [ isAnimating , setIsAnimating ] = useState ( false ) ;
103103
104104 if ( ! currentSelection ) {
105- return < React . Fragment > keyword</ React . Fragment > ;
105+ return < Fragment > keyword</ Fragment > ;
106106 }
107107
108108 const selector = isOpen && (
@@ -135,7 +135,7 @@ function KeywordSelector({keyword, group, index}: KeywordSelectorProps) {
135135 const portal = getPortal ( ) ;
136136
137137 return (
138- < React . Fragment >
138+ < Fragment >
139139 < KeywordDropdown
140140 key = { index }
141141 ref = { setReferenceEl }
@@ -165,9 +165,8 @@ function KeywordSelector({keyword, group, index}: KeywordSelectorProps) {
165165 </ AnimatePresence >
166166 </ span >
167167 </ KeywordDropdown >
168- { portal &&
169- ReactDOM . createPortal ( < AnimatePresence > { selector } </ AnimatePresence > , portal ) }
170- </ React . Fragment >
168+ { portal && createPortal ( < AnimatePresence > { selector } </ AnimatePresence > , portal ) }
169+ </ Fragment >
171170 ) ;
172171}
173172
0 commit comments