{...props} có nghĩa gì :) (ok)

C:\Users\Administrator\Desktop\app\src\components\UI\Card\index.js

import React from 'react';
import './style.css';
const Card = (props) => {
  return(
    <div className="card" style={{ width: props.width ? props.width: '100%' }} {...props}>
      {props.children}
    </div>
   )
 }
export default Card

C:\Users\Administrator\Desktop\app\src\components\Hero\index.js

import React from 'react';
import './style.css';
import Card from '../UI/Card';
import Logo from '../Logo';
import Navbar from '../Navbar';
const Hero = () => {
  return (
    <Card width="100%">
      <div style={{ padding: '50px 0'  }}>
        <Logo />
      </div>
      <Navbar />
    </Card>
  )
}
export default Hero

Last updated

Was this helpful?