Problem: fixWidth.jsx throws Invariant Violation in React v15
See original GitHub issueinvariant.js:39 Uncaught Invariant Violation: traverseParentPath(…): Cannot traverse from and to the same ID, ``.
Code to reproduce
import React from "react";
import d3 from "d3";
import ReStock from "react-stockcharts";
var {ChartCanvas, Chart} = ReStock;
var {CandlestickSeries} = ReStock.series;
var {XAxis, YAxis} = ReStock.axes;
var {fitWidth} = ReStock.helper;
class CandleStickChart extends React.Component {
render() {
const {type, width, data} = this.props;
return (
<ChartCanvas width={width} height={400}
margin={{left: 0, right: 0, top:25, bottom: 30}} type={type}
data={data}
seriesName='CandleStick'
xAccessor={d => d.date} xScale={d3.time.scale()}>
<Chart id={1} yExtents={d => [d.high, d.low]}>
<XAxis axisAt="bottom" orient="bottom" ticks={6} stroke="none" tickStroke="#9E9E9E"/>
<YAxis axisAt="left" orient="right" ticks={10} stroke="none" tickStroke="#9E9E9E"/>
<CandlestickSeries fill={d => d.close > d.open ? "#32c2b0" : "#EDB24E"}/>
</Chart>
</ChartCanvas>
);
}
}
CandleStickChart.propTypes = {
data: React.PropTypes.array.isRequired,
width: React.PropTypes.number.isRequired,
type: React.PropTypes.oneOf(["svg", "hybrid"]).isRequired,
};
CandleStickChart.defaultProps = {
type: "svg"
};
CandleStickChart = fitWidth(CandleStickChart);
export default CandleStickChart;
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
React App is not coming up. Error:INvariant Violation
Throws error: Invariant Violation Element type is invalid: expected a string (for built-in components) or a class/function (for composite ...
Read more >Invalid Hook Call Warning - React
You are probably here because you got the following error message: Hooks can only be called inside the body of a function component....
Read more >Understanding the "Objects are not valid as a react child" Error ...
The problem starts when myVariable assumes an object. React has no way to tell what to render when provided with an object, thus...
Read more >Invariant Violation: Failed to call into JavaScript module ...
ERROR Invariant Violation : Failed to call into JavaScript module method AppRegistry. ... error when loading React Native., js engine: hermes ...
Read more >Troubleshooting common React Native bugs - LogRocket Blog
Dependencies error. Import error. Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This happens when using npm, react-stockcharts is loading the older version of react and its conflicting with 15.0.1. Once react-stockcharts is updated to depend on 15.0.1 it should resolve the issue.
fixed, published in 0.5