Answers for "makeStyles caling theme"

0

makeStyles caling theme

export const useStyles = makeStyles(theme => ({
    mySelector: props => ({
        display: 'block',
        width: props.width,
        height: props.height,
    }),
}));
Posted by: Guest on February-10-2021
0

makeStyles caling theme

import React from 'react';
import { makeStyles } from '@material-ui/styles';

import { useStyles } from './my-component.styles.js'; 

const myComponent = (props) => {
    const styleProps = { width: '100px', height: '100px' };
    const classes = useStyles(styleProps);

    return (
        <div className={classes.mySelector}></div> // with 100px and height 100px will be applied
    )
}
Posted by: Guest on February-10-2021

Browse Popular Code Answers by Language