LoginSignup
0
0

More than 1 year has passed since last update.

React props渡し方

Posted at

子供コンポーネント


import React from "react";

const Button = ({ name, age }) => {
  return (
    <div>
      私は{age}歳です名前は{name}です
    </div>
  );
};

export default Button;

親コンポーネント

import Button from "./components/Button";
<Button name="JOHN" age={20} />
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0