为什么内联样式对组件没有反应?

Why inline styling doesnt work in react on components?

为什么内联样式在组件上不起作用?我不明白为什么这不是 working.I 知道可以用不同的方式来实现它。(例如 css 文件)。我只是corius.The 智能感知对内联样式没有帮助either.Its 奇怪..

import "./App.css";
import Button from "./components/Button";

function App() {
  return (
    <div className="App"  >
      <Button style={{fontSize:"50px"}} />
    </div>
  );
}

export default App;

//this is from Button components

import React from "react";

const Button = () => {

  return (
    <div>
      <button>
        Change
      </button>
    </div>
  );
};

export default Button;

您需要将 style 属性 传递给 Button 组件:

const Button = ({style}) => {

  return (
    <div>
      <button style={style}>
        Change
      </button>
    </div>
  );
};