% unit is somehow causing "Maximum update depth exceeded"
See original GitHub issueHi,
we are using react-image-crop:8.6.2 in our project and if we set unit
in crop object to “%” it ends up with “Maximum update depth exceeded”.
<ReactCrop
src={image}
crop={crop}
ruleOfThirds
onImageLoaded={onImageLoaded}
onComplete={onCropComplete}
onChange={onCropChange} // just setting state
keepSelection
/>
const [currentCrop, setCurrentCrop] = useState({
unit: '%', // `'px' here just works fine`
width: 100,
height: 50,
x: 25,
y: 25,
...imageCrop,
});
The last working version was 8.5.0.
Thank you for your help.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
ReactJS: Maximum update depth exceeded error
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
Read more >Fix the "Maximum Update Depth Exceeded" Error in React
One of which is when you accidentally cause an infinite render loop, often resulting in the cryptic “maximum update depth exceeded” error.
Read more >"Maximum update depth exceeded" with version 7.1.0 · Issue ...
"Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
Read more >React - maximum update depth exceeded - CodeProject
Yes! I solved this problem! It was because of the useEffect(), but it wasn't because it was being used twice.
Read more >How to Fix Maximum Update Depth Exceeded in React and ...
In this video, I show you several ways the dreaded " Max Update Depth Exceeded " error commonly occurs in React and React...
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
Thank you. 8.6.3 is working just fine. 👍
Ok cool, this should be fixed in 8.6.3 anyway. If you do want to limit the crop width though I recommend just doing it on a container element of the crop (but it should work now). Closing but please feel free to add any issues with it.