admin管理员组文章数量:1295295
I'm trying to install the standalone react-devtools, which by default listens to port 8097. My app uses port 3001. The documentation says the following:
"By default DevTools listen to port 8097 on localhost. If you need to customize host, port, or other settings, see the react-devtools-core package instead."
How do I go about changing the port to listen to 3001 instead?
Source:
I'm trying to install the standalone react-devtools, which by default listens to port 8097. My app uses port 3001. The documentation says the following:
"By default DevTools listen to port 8097 on localhost. If you need to customize host, port, or other settings, see the react-devtools-core package instead."
How do I go about changing the port to listen to 3001 instead?
Source: https://github./facebook/react-devtools/tree/master/packages/react-devtools
Share Improve this question edited Jul 9, 2017 at 1:39 Paul Roub 36.5k27 gold badges86 silver badges95 bronze badges asked Mar 28, 2017 at 16:12 a7dca7dc 3,4268 gold badges37 silver badges57 bronze badges2 Answers
Reset to default 4The docs advise to have a look at react-devtools-core
:
require('react-devtools-core').connectToDevTools(options)
This is similar to
require('react-devtools')
in another package but providing more control. Unlikerequire('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 anyreact
,react-dom
, orreact-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.
You can also change your emulator or device port to 8097. Worked for me.
Eg: adb -s <device-name> reverse tcp:8097 tcp:8097
How to find device name: run adb devices
本文标签:
版权声明:本文标题:javascript - react-devtools: By default DevTools listen to port 8097 on localhost. How to customise? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741616544a2388558.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论