In the React project, I want to be able to use div and canvas tags in {}, but this is not valid now

<div className={"break_down_div"}>
                {this.state.breakDown && this.state.breakDown.length != 0?
                    <canvas className={"blueCircle"} ></canvas>
                    <div
                    ref={(elem) => { this.element = elem; }}
                    style = {divStyle}
                    className={`${this.props.styleSet}`}
                    >
                    </div>
                    :
                }

            </div>

Feb.28,2021

put canvas and div under one node


  

component class can only contain one top-level tag, otherwise it will report an error and wrap canvas and div in tags

Menu