Skip to content

Memory leak #48

@ffirenze

Description

@ffirenze

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

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions