REACT_API_UNSUPPORTED: React API not supported
Este conteúdo não está disponível em sua língua ainda.
| Severity | Fault | Stage |
|---|---|---|
| warning | customer (the source package) | compile |
What it means
Section titled “What it means”The component, or a library it imports, uses a React API that Preact’s compatibility layer (preact/compat, where react and react-dom resolve) does not provide, such as use, useActionState, useOptimistic, useFormStatus or Profiler, or a React entry point it does not have (react-dom/server, react/compiler-runtime); or it mounts a React root itself (createRoot, render), which a component never needs. A named import of a missing API is an error: the bundle could not load in the browser. A missing API read through a namespace or default import (React.use) is a warning: it is undefined when the code runs, and the component’s error boundary catches the failure. Mounting a root is a warning.
How to fix
Section titled “How to fix”Use the supported alternative the message names (useState and an async handler for useActionState, useContext for use(context)), or write that part with Preact’s own hooks. The runtime mounts the component: export it with defineTaggorComponent instead of calling createRoot.