Untitled
8 months ago in JavaScript
import React, { useContext } from 'react';
import { ThemeContext } from '../context/ThemeContext';
const Card = ({title, description}) => {
const {theme, setTheme} = useContext(ThemeContext)
return (
<div className={theme}>
<h2>{title}</h2>
<p>{description}</p>
<button onClick={()=>theme=="light"?
setTheme("dark"):
setTheme("light")
}>Change Theme</button>
</div>
);
};
export default Card;