React & SVG 最大宽度

Ari*_*deh 8 html javascript css svg reactjs

我想在 React 组件中使用 max-width。我尝试了max-widthand maxWidthattributes ,但看起来它在我检查时从元素中被省略了。(当我把它放在 CSS 中时,它就起作用了。)

Ale*_*erg 9

您需要使用该style属性。请参阅内联样式

<div style={{ maxWidth: 250 }}></div>
Run Code Online (Sandbox Code Playgroud)