i'm currently working on a small chat app , using reactJS an materialUI component library.
Material UI use a lot of objet to describe the style of our element (like the "sx" props).
I was wondering if i still should use css or shouhd i put my css into my component as an object (more like a vue component). here is an example with an object :
import React from 'react'
import CameraAltIcon from '@mui/icons-material/CameraAlt'
const AvatarForm = ({setAvatar}) => {
return (
<Box sx={sx}>
<label htmlFor="photo">
<CameraAltIcon />
</label>
<input
type="file" accept="image/*"
id="photo"
onChange={ e => setAvatar(e.target.files[0])}
style={{display: "none"}}
/>
</Box>
)
}
export default AvatarForm
const sx = {
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
textAlign: "center",
}
Is it a good practice ? and why ?