Card.js
import React from "react";
import classes from './Card.module.css';
const Card=(props)=>{
return <div className={classes.card}>{props.children}</div>//For Dynamic below code cssClassName as ClassName default // return <div className={`${classes.card} ${props.cssClassName}`}>{props.children}</div>
}
export default Card
Card.module.css
.card{
background-color: yellow;
}
App.js
import Form from './Components/Form';
import './App.css';
import { useState } from 'react';
import UserList from './Components/UserList';
import Card from './Components/UI/Card';
function App() {
const data=[{"name":1,"age":2},{"name":11,"age":21}];
const [users,setusers]=useState([]);
const userlist=(res)=>{
setusers(prevuser=>{
return [res,...prevuser];
})
}
return (<Card > // <Card cssClass={classes.input}>
<div className="App">
<Form userdata={userlist}></Form>
<UserList items={users}></UserList>
</div></Card>
);
}
export default App;
No comments:
Post a Comment