Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

189
Vistas
Issue with Slate Js Mention example while integerating

Referring to the Slate.js mention example, https://github.com/ianstormtaylor/slate/blob/main/site/examples/mentions.tsx I want to integrate it with my React app.While integration facing issue with hooks used in the code..

QueryComponent.js

const QueryBoxComponent = () => {
    const ref = useRef<HTMLDivElement | null>()
    const [target, setTarget] = useState<Range | undefined>()
    const [index, setIndex] = useState(0)
    const [search, setSearch] = useState('')
    const renderElement = useCallback(props => <Element {...props} />, [])
    const editor = useMemo(
      () => withMentions(withReact(withHistory(createEditor()))),
   []
   )

   const chars = CHARACTERS.filter((c) =>
    c.toString().toLowerCase().startsWith(search.toLowerCase())
      ).slice(0, 10);

I am calling it as a functional component:

    <div className="stockfilterresult" style={{ marginTop: "10px" }}>
            <QueryBoxComponent />
    </div>

Error image

 const ref = useRef<HTMLDivElement | null>();                                             ^
  35 | const [target, setTarget] = useState<Range | undefined>();
  36 |   const [index, setIndex] = useState(0);
  37 |   const [search, setSearch] = useState('');

 BabelLoaderError: SyntaxError: 
   C:/Users/HP/Downloads/StockUI/src/components/QueryBoxComponent.jsx: Unexpected token (34:44)
34 |   const ref = useRef<HTMLDivElement | null>();
about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda