WinterCore / react-text-transition

Animate your text changes
MIT License
601 stars 26 forks source link

Memory leak #48

Open ffirenze opened 2 years ago

ffirenze commented 2 years ago

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}/>);
}

}`

thepirateboy commented 2 years ago

Up this, facing the same issue.