Third-party libraries updated by React state did not re-render

I need to transfer some style defined by js to a third-party library, but it seems that state does not re-render the style after the update. I am sure the component has been updated, but the style transferred into this third-party library has not been updated. Can anyone help solve it?

the code is as follows

class Console extends React.Component {

  getConsoleFeedStyle(theme) {
    const style = {};
    switch (theme) {
      case "light":
        return Object.assign(style, a);
      case "dark":
        return Object.assign(style, b);
      case "contrast":
        return Object.assign(style, c);
      default:
        return "";
    }
  }


render() {
    return (
        <div>
          {this.props.consoleEvents.map((consoleEvent) => {
            const { theme } = this.props;
            return (
              <div key={consoleEvent.id}>
                <ConsoleFeed
                  styles={this.getConsoleFeedStyle(theme)}
                  logs={Array.of(consoleEvent)}
                />
              </div>
            );
          })}
        </div>
      </div>
    );
  }
}
Mar.15,2021

this is a component, not a div.
you pass style, but he doesn't use it in his components. What's the use of passing it


add console, to getConsoleStyle function and render function and console parameter in getConsoleStyle function to see whether the running logic is consistent with your expectation


first debug in getConsoleFeedStyle to see if it is running, and to see if the key of a getConsoleFeedStyle is the correct style

.
Menu