mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-26 08:25:04 +03:00
27 lines
622 B
JavaScript
27 lines
622 B
JavaScript
import React, { Component } from 'react';
|
|
|
|
export default class Flashing extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.alive = true;
|
|
this.state = { color: "black" };
|
|
}
|
|
|
|
//memory cleanup
|
|
componentWillUnmount() {
|
|
this.alive = false;
|
|
}
|
|
|
|
render() {
|
|
setTimeout(()=>{
|
|
if(this.alive) {
|
|
if(this.state.color == "black") { this.setState({color: "white"}) }
|
|
else if(this.state.color == "white") { this.setState({color: "black"}) }
|
|
}
|
|
},400);
|
|
|
|
return <div style={{ color: this.state.color }}>
|
|
{this.props.children}
|
|
</div>
|
|
}
|
|
} |