preact调试及react-dev-tools的使用


  • administrators

    资源下载

    react-dev-tools 3.1.0版 Chrome crx点击下载

    操作步骤

    1. Install the React Developer Tools extension
    2. Import the "preact/debug" module in your app
    3. Set process.env.NODE_ENV to 'development'
    4. Reload and go to the 'React' tab in the browser's development tools
    import { h, Component, render } from 'preact';
    
    // Enable debug mode. You can reduce the size of your app by only including this
    // module in development builds. eg. In Webpack, wrap this with an `if (module.hot) {...}`
    // check.
    require('preact/debug');
    

    注意事项

    • 要想在浏览器查看React组件,应做如下调整:
      // require('preact/debug')
      require('preact/devtools')
    

Log in to reply
 

Looks like your connection to 新前端社区 was lost, please wait while we try to reconnect.