Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Node extends Component {
- componentDidMount() {
- this.queueUpdate()
- }
- componentDidUpdate() {
- this.queueUpdate()
- }
- queueUpdate = () => {
- const {
- dispatch,
- id,
- } = this.props
- this
- .timeoutId = (
- setTimeout(
- () => {
- dispatch(
- queueAction(
- updateNode(id)
- )
- )
- },
- getRandomTimeout(),
- )
- )
- }
- render() {
- const {
- color,
- value,
- x,
- y,
- } = this.props
- return (
- <div
- style={{
- color,
- left: `${x}ch`,
- position: 'absolute',
- top: `${y}em`,
- }}
- >
- {value}
- </div>
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement