React Project Cannot add property style, object is not extensible

import React from "react";


class PublicScreen extends React.Component {
    constructor(props) {
        super(props);

        this.getStyle = this.getStyle.bind(this);
    }


    getStyle() {
        const { width = 1920, height = 1080 } = this.props.style || {};

        const root = document.querySelector("-sharproot");
        const per = root.clientWidth / width;
        return {
            width: width,
            height: height,
            transformOrigin: "left top",
            transform: "scale(" + per + ")"
        };
    }


    render() {

        const { width = 1920, height = 1080 } = this.props.style || {};

        const childrenStyle = this.props.children.props.style || {};
        this.props.children.props.style = { height, width, ...childrenStyle };

        return <div ref={(elem) => { this.element = elem; }}
                    className="screen">
            {this.props.children}
        </div>;


    }

    componentDidMount() {


        // 
        const screen = this.element;
        const getStyle = this.getStyle;

        function adaptiveScreen() {
            const style = getStyle();
            for (let k in style) {
                screen.style[k] = style[k];
            }
        }

        let timeout = null;
        window.addEventListener("resize", () => {
            clearTimeout(timeout);
            timeout = setTimeout(function () {
                adaptiveScreen();
            }, 400);
        });
        adaptiveScreen();


    }


}

export default PublicScreen;
< H1 > add < / H1 >

PublicScreen components

render() {

        const { width = 1920, height = 1080 } = this.props.style || {};

        const childrenStyle = this.props.children.props.style || {};
        this.props.children.props.style = { height, width, ...childrenStyle };

        return <div ref={(elem) => { this.element = elem; }}
                    className="screen">
            {this.props.children}
        </div>;


    }

call

render() {

        return <PublicScreen style={{ width: 1920, height: 1080 }} {...this.props}>
                <div
                    className={"fl_screen"}>
                    {/*  */}
                    <Availability
                        styleSet={"cpu_availability"}
                        availability = {this.state.cpuAvailability}
                    />

                </div>

            </PublicScreen>;
    }

Feb.26,2021

component PublicScreen does not support the style attribute, which must be defined within the component if you want to use it.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b15f0e-2afed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b15f0e-2afed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?