小编Júl*_*zer的帖子

使用React 16的Chrome开发工具中的"性能"选项卡中的"用户时间"部分没有时序细分

我正在关注这篇文章:https://calibreapp.com/blog/2017-11-28-debugging-react/

我运行分析但是当我点击组件时,我看不到确切的时间,正如文章中提到的那样.

我使用React 16,我处于开发模式.我也试过?react_perf但是没有帮助(无论如何应该是React 15)

在此输入图像描述

谢谢你的回答

google-chrome-devtools reactjs

6
推荐指数
1
解决办法
272
查看次数

使用React 16.3.2时未调用UNSAFE_componentWillReceiveProps

我遵循了https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path中的建议,升级到React 16.3.2后,我想重命名所有即将被淘汰的生命周期方法与其UNSAFE_等效方法。

但是我注意到UNSAFE_componentWillReceiveProps根本没有调用。当我更改回componentWillReceiveProps它的作品。有什么想法吗?

class Chart extends React.Component<ChartProps> {
  chartContainer: SVGSVGElement;
  tooltip: HTMLDivElement;
  xScale: ScaleBand<string>;
  yScale: ScaleLinear<number, number>;

  UNSAFE_componentWillReceiveProps(nextProps: Props) {
    ...
  }
...
}
Run Code Online (Sandbox Code Playgroud)

javascript typescript reactjs

5
推荐指数
1
解决办法
2005
查看次数

如何让图片可以点击

<div className="col-lg-3 col-md-3">
    <li>
      <img src='https://i.imgur.com/fe0T4nw.png' onClick="https://arizonaatwork.com" />
    </li>
</div>
Run Code Online (Sandbox Code Playgroud)

在我的项目中,我正在导入图像,并且在 onclick 时我希望图像将它们带到 URL。我怎样才能完成这件事?

reactjs bootstrap-4

4
推荐指数
1
解决办法
2万
查看次数