Material UI v5: TypeError: Cannot read properties of undefined (reading ‘create’)

Just ran into this myself. You can import createTheme from @mui/material/styles or @mui/system, but they do slightly different things: You can use the utility coming from the @mui/system package, or if you are using @mui/material, you can import it from @mui/material/styles. The difference is in the default theme that is used (if no theme is … Read more

Solve having more than one copy of React in the same app

In the module you are developing, add the conflicting packages to peerDependencies (and remove them from dependencies or devDependencies): // package.json “peerDependencies”: { “react”: “16.13.1”, “react-dom”: “16.13.1” }, Execute npm install in your module. Now add react and react-dom to the webpack configuration of your module as externals. These packages shouldnt be included in the … Read more

Re-render component when navigating the stack with React Navigation

If you are using React Navigation 5.X, just do the following: import { useIsFocused } from ‘@react-navigation/native’ export default function App(){ const isFocused = useIsFocused() useEffect(() => { if(isFocused){ //Update the state you want to be updated } }, [isFocused]) } The useIsFocused hook checks whether a screen is currently focused or not. It returns … Read more

Decode Jwt token React

It seems like you are using JWT. To decode this type of token you can simply use jwt-decode library. For example, in ReactJS: import { jwtDecode } from ‘jwt-decode’ // import dependency // If using v3 or earlier, use this instead: // import jwtDecode from ‘jwt-decode’ // import dependency // some logic axios.post(`${axios.defaults.baseURL}/auth`, { email, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)