gpt4 book ai didi

javascript - react-devtools:默认情况下,DevTools 监听本地主机上的 8097 端口。如何定制?

转载 作者:行者123 更新时间:2023-11-29 17:51:34 29 4
gpt4 key购买 nike

我正在尝试安装独立的 react-devtools,它默认监听端口 8097。我的应用程序使用端口 3001。文档说明如下:

“默认情况下,DevTools 监听本地主机上的端口 8097。如果您需要自定义主机、端口或其他设置,请参阅 react-devtools-core 包。”

我该如何更改端口以改为监听 3001?

来源:https://github.com/facebook/react-devtools/tree/master/packages/react-devtools

最佳答案

文档建议查看 react-devtools-core :

require('react-devtools-core').connectToDevTools(options)

This is similar to require('react-devtools') in another package but providing more control. Unlike require('react-devtools'), it doesn't connect immediately, but exports a function.

Run connectToDevTools() in the same context as React to set up a connection to DevTools. Make sure this runs before any react, react-dom, or react-native imports.

The options object may contain:

  • host (string), defaults to 'localhost'.
  • port (number), defaults to 8097.
  • resolveRNStyle (function), used by RN and null by default.

关于javascript - react-devtools:默认情况下,DevTools 监听本地主机上的 8097 端口。如何定制?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43074677/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com