React Developer Tools says “Proxy component” instead of component name

I use Webpackwith Hot Module Reloading. I also use the chrome extension React Developer Toolsto test the reaction tree during development. When I check the page and look at the component tree, I would like to see the name of the actual components, however for each component the name displays as Proxy Component.

I can tell you more details about mine Webpack, but I'm struggling to solve the problem with Google.

Here are the tools I use for webpack:

"webpack": "^1.9.6",
"webpack-dev-middleware": "^1.2.0",
"webpack-dev-server": "^1.14.1",
"webpack-hot-middleware": "^2.0.0"

webpack.config.js

var path = require('path');
var webpack = require('webpack');

module.exports = {
  devtool: 'eval',
  entry: [
    'webpack-hot-middleware/client',
    './client/index'
  ],
  output: {
    path: path.join(__dirname, 'static'),
    filename: 'bundle.js',
    publicPath: '/static/'
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoErrorsPlugin()
  ],
  module: {
    loaders: [
      {
        test: /\.json$/,
        loader: 'json'
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: path.join(__dirname, 'client'),
        query: {
          plugins: ['transform-runtime'],
          presets: ['es2015', 'stage-0', 'react', 'react-hmre']
        }
      },
      {
        test: /\.scss$/,
        loaders: ['style', 'css', 'sass']
      }
    ]
  }
};
+4
source share
2 answers

Have you tried to assign a property displayName?

export const Navbar = (props) => {
  let title = null;
  let menu = null;

  return (
    <header className={style.navbar}>
      <Grid>
        <Row>
          <Col xs={12} sm={12} md={12} lg={12}>
            {title}
            {menu}
          </Col>
        </Row>
      </Grid>
    </header>
  );
};

Navbar.displayName = 'Navbar'; // LIKE THIS

Navbar.propTypes = {
  title: PropTypes.string,
  items: PropTypes.arrayOf(PropTypes.node),
};
+2

, , node "production". React , ProxyComponent .

React Transform. Dan Abramov , Hot Reloading for React , - displayName . displayName, , React devtools ProxyComponent: ProxyComponent.

+4

All Articles