0 points

javascript - React: Dynamic styles in component not updating - Stack Overflow


dashboard

Mon Sep 07 2020 13:36:50 GMT+0000 (UTC)

Posted by @hbenfred #javascript

// Cell.js
import React, { Component } from 'react';

export default class Cell extends Component {

  render() {
    const cellSize = {
      width: this.props.size,
      height: this.props.size
    }

    return (
      <div style={cellSize}>
      </div>
    );
  }
}
content_copy Copy

https://stackoverflow.com/questions/61547522/react-dynamic-styles-in-component-not-updating