Is there a way to bold a word within a Material-UI Typography element within a Card without a shift on render?

Have you tried with Box component? You could do something like <Typography component=”div”>Normal text <Box fontWeight=”fontWeightMedium” display=’inline’>medium font weight text</Box> and some more normal text</Typography> Note that component=”div” prop on Typography wrapper is required as Box component cannot be nested under the Typography’s default p. Source Typography font weight

When should I use style instead of sx prop in Material-UI?

To really understand which one to use, we need to understand what’s happening under the hood. Material UI uses emotion(, or whatever styling engine you chose manually), in order to style its components. On the surface, the following two might seem to be doing the same thing: <Box sx={{ height:’50px’, width:’25px’ }}/> <div style={{ height:’50px’, … Read more

React Material-UI Modal TypeError: Cannot read property ‘hasOwnProperty’ of undefined

Explanation The reason for MUI Modal component having the error TypeError: Cannot read property ‘hasOwnProperty’ of undefined Is that you didn’t give a JSX component as a child. Solution Change from this <Modal open={true}> Hello </Modal> to <Modal open={true}> <div> Hello </div> </Modal> More If you search the source of Material-UI project by the keyword … Read more

background-image in react component

You have to import the image as the following, using the relative path. import React from ‘react’; import Paper from ‘material-ui/Paper’; import IconButton from ‘material-ui/IconButton’; import ActionHome from ‘material-ui/svg-icons/action/home’; import Image from ‘../img/main.jpg’; // Import using relative path const styles = { paperContainer: { backgroundImage: `url(${Image})` } }; export default class Home extends React.Component{ render(){ … Read more