Reactjs - setting inline styles correctly

后端 未结 4 636
日久生厌
日久生厌 2020-12-13 01:30

I am trying to use Reactjs with a kendo splitter. The splitter has a style attribute like

style=\"height: 100%\"

With Reactjs, if I have un

4条回答
  •  自闭症患者
    2020-12-13 02:29

    Correct and more clear way is :

    My inline Style

    It is made more simple by following approach :

    // JS
    const styleObject = {
          "font-size" : "10px",
          "height" : "100px",
          "width" : "100%"
    }
    
    // HTML    
    
    My inline Style

    Inline style attribute expects object. Hence its written in {}, and it becomes double {{}} as one is for default react standards.

提交回复
热议问题