react-text-transition icon indicating copy to clipboard operation
react-text-transition copied to clipboard

Memory leak

Open ffirenze opened this issue 2 years ago • 1 comments

I was using the component in a project, but it was causing a memory overflow.

A sample code with higth refresh frequency to check the leak: ` import React from 'react' import TextTransition, { presets } from "react-text-transition";

export default class Map extends React.Component { constructor(props) { super(props);

    this.state = { 
        data: 9999
    }
}

componentDidMount() {
    this.interval = setInterval(() => this.setState({data: this.state.data + 1}), 500);
}

componentWillUnmount() {
    clearInterval(this.interval);
}

render() {
    const { data } = this.state;
    return (<TextTransition text={`Iteration number: ${data.toString()}`} springConfig={presets.wobbly}/>);
}

}`

ffirenze avatar Jun 25 '22 13:06 ffirenze

Up this, facing the same issue.

thepirateboy avatar Aug 03 '22 01:08 thepirateboy