mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-27 08:30:02 +03:00
ref
This commit is contained in:
parent
5ae11fdced
commit
99954cd1c7
|
@ -1,6 +1,5 @@
|
||||||
import React, { Component } from 'react';
|
import React, { Component, createRef } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { findDOMNode } from 'react-dom';
|
|
||||||
import { tree } from 'd3-state-visualizer';
|
import { tree } from 'd3-state-visualizer';
|
||||||
|
|
||||||
const wrapperStyle = {
|
const wrapperStyle = {
|
||||||
|
@ -61,9 +60,11 @@ class Chart extends Component {
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
divRef = createRef();
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { select, state, defaultIsVisible } = this.props;
|
const { select, state, defaultIsVisible } = this.props;
|
||||||
this.renderChart = tree(findDOMNode(this), this.props);
|
this.renderChart = tree(this.divRef.current, this.props);
|
||||||
if (defaultIsVisible) {
|
if (defaultIsVisible) {
|
||||||
this.renderChart(select(state));
|
this.renderChart(select(state));
|
||||||
}
|
}
|
||||||
|
@ -78,7 +79,7 @@ class Chart extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <div style={wrapperStyle}/>;
|
return <div style={wrapperStyle} ref={this.divRef}/>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user