mirror of
https://github.com/facebook/react.git
synced 2026-02-23 20:23:02 +00:00
* Add version 4 react-devtools and react-devtools-core packages which support both React Native and e.g. Safari or iframe DOM usage. * Replaces typed operations arrays with regular arrays in order to support Hermes. This is unfortunate, since in theory a typed array buffer could be more efficiently transferred between frontend and backend for the web extension, but this never actually worked properly in v8, only Spidermonkey, and it fails entirely in Hermes so for the time being- it's been removed. * Adds support for React Native (paper renderer) * Adds a style editor for react-native and react-native-web
1.6 KiB
1.6 KiB
react-devtools-core
A standalone React DevTools implementation.
This is a low-level package. If you're looking for the Electron app you can run, use react-devtools package instead.
API
react-devtools-core
This is similar requiring the react-devtools package, but provides several configurable options. Unlike react-devtools, requiring react-devtools-core doesn't connect immediately but instead exports a function:
const { connectToDevTools } = require("react-devtools-core");
connectToDevTools({
// Config options
});
Run connectToDevTools() in the same context as React to set up a connection to DevTools.
Be sure to run this function before importing e.g. react, react-dom, react-native.
The options object may contain:
host: string(defaults to "localhost") - Websocket will connect to this host.port: number(defaults to8097) - Websocket will connect to this port.websocket: Websocket- Custom websocked to use. Overrideshostandportsettings if provided.resolveNativeStyle: (style: number) => ?Object- Used by the React Native style plug-in.isAppActive: () => boolean- If provided, DevTools will poll this method and wait until it returns true before connecting to React.
react-devtools-core/standalone
Renders the DevTools interface into a DOM node.
require("react-devtools-core/standalone")
.setContentDOMNode(document.getElementById("container"))
.setStatusListener(status => {
// This callback is optional...
})
.startServer(port);
Reference the react-devtools package for a complete integration example.