简体   繁体   中英

Can't resolve '@material-ui/styles/styled' in '@material-ui\core\Box'

Hi iam using react with material ui core.

I get the error you see in the title when iam trying to use the new box inside of typography component.

import Typography from "@material-ui/core/Typography";
import { unstable_Box as Box } from "@material-ui/core/Box";

 function sayHello() {
   return (
   <div >
     <Typography>
       <Box textAlign="left">Hello</Box>
     </Typography>
   </div>
  );}

I have updated material ui core to the new version 3.8.1. I have also updated material ui next but error still exists. Please help. How to use the new material ui component ? Please help.

you need to run yarn add @material-ui/styles@next or npm install @material-ui/styles@next

Did run into the same problem, and it seems that you need the alpha version of styled to run this.

This is going to be part of material ui core soon I believe :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM