I'm working on react-form-hook with yup validation. All dependencies are installed well and updated in package.json file but validations are not working.
All those yup validations are well in codesandbox.io with the same code. And I've added a nav bar with react-bootstrap and that too is not working.
Below are the dependencies installed:
"dependencies": {
"#hookform/error-message": "0.0.4",
"#testing-library/jest-dom": "^5.11.5",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"react": "^17.0.1",
"react-bootstrap": "^1.4.0",
"react-dom": "^17.0.1",
"react-hook-form": "^6.10.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.0",
"rsuite": "^4.8.4",
"web-vitals": "^0.2.4",
"yup": "^0.29.3"
},
Below is the import section
import React from "react";
import { useForm } from "react-hook-form";
import * as Yup from "yup";
I get no errors at all.
Related
Why do I keep encountering this error when using the Grid of MUI in my react component
this is the whole code of the component
import React from "react";
import Grid from "#mui/material/Grid";
const Footer = () => {
return (
<footer>
<Grid container spacing={2}>
<Grid item xs={6} md={8}>
hasdsadsa
</Grid>
</Grid>
</footer>
);
};
export default Footer;
but once I comment the Grid Tag below the program runs fine
package.json
"dependencies": {
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"bootstrap": "^5.2.2",
"react": "^18.2.0",
"react-bootstrap": "^2.5.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.4.2",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
According to Font Awesome documentation, I followed this example below but didn't get any result. I used font awesome a lot of time on my html project in the past. But this is for the first time I am using it on my React Application. How can I get the icons from font awesome on my react application?
import React from 'react'
import { FontAwesomeIcon } from '#fortawesome/react-fontawesome'
export const Beverage = () => (
<div>
<FontAwesomeIcon icon="check-square" />
Your <FontAwesomeIcon icon="coffee" /> is hot and ready!
</div>
)
There is my package.json dependencies.
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^6.1.2",
"#fortawesome/free-solid-svg-icons": "^6.1.2",
"#fortawesome/react-fontawesome": "^0.2.0",
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"axios": "^0.27.2",
"bootstrap": "^5.2.0",
"formik": "^2.2.9",
"jquery": "^3.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-redux": "^8.0.2",
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"redux": "^4.2.0",
"redux-thunk": "^2.4.1",
"web-vitals": "^2.1.4"
}
https://github.com/FortAwesome/react-fontawesome
Commands : install fontawesome & react-fontawesome
$ npm i --save #fortawesome/fontawesome
$ npm i --save #fortawesome/react-fontawesome
$ npm i --save #fortawesome/fontawesome-free-solid
$ npm i --save #fortawesome/fontawesome-free-regular
$ npm i --save #fortawesome/fontawesome-svg-core
then in your component app.
import React, { Component } from 'react';
import { FontAwesomeIcon } from '#fortawesome/react-fontawesome'
import { faCoffee } from '#fortawesome/fontawesome-free-solid'
export const Beverage = () => (
<div>
Your <FontAwesomeIcon icon={faCoffee} />is hot and ready!
</div>
)
I am creating a component library using React, TypeScript, Rollup, and Styled Components. Now I have come quite far but I'm stuck at what I think is the last part.
I have my button component in my library being exported from it. Now I am able to import this button component to my main project after I've installed it, but I'm getting the following error:
I'm doing nothing much more than editing the standard React beginning page like this:
import "./App.css";
import { ButtonBase } from "aab-react-emerald";
function App() {
return (
<div className="App">
<header className="App-header">
<ButtonBase>Button</ButtonBase>
</header>
</div>
);
}
export default App;
I have compared both the package.json files, and I think they're fine:
Library (removed some stuff that was unnecessary):
"devDependencies": {
"#rollup/plugin-commonjs": "^22.0.1",
"#rollup/plugin-node-resolve": "^13.3.0",
"#rollup/plugin-typescript": "^8.3.3",
"#storybook/addon-actions": "^6.5.9",
"#storybook/addon-essentials": "^6.5.9",
"#storybook/addon-interactions": "^6.5.9",
"#storybook/addon-links": "^6.5.9",
"#storybook/builder-webpack5": "^6.5.9",
"#storybook/manager-webpack5": "^6.5.9",
"#storybook/node-logger": "^6.5.9",
"#storybook/preset-create-react-app": "^4.1.2",
"#storybook/react": "^6.5.9",
"#storybook/testing-library": "^0.0.13",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"#types/jest": "^28.1.4",
"#types/node": "^18.0.3",
"#types/react": "^18.0.15",
"#types/react-dom": "^18.0.6",
"#types/styled-components": "^5.1.25",
"babel-plugin-named-exports-order": "^0.0.2",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"rollup": "^2.76.0",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-peer-deps-external": "^2.2.4",
"styled-components": "^5.3.5",
"tsconfig-paths-webpack-plugin": "^3.5.2",
"tslib": "^2.4.0",
"typescript": "^4.7.4",
"webpack": "^5.73.0"
},
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.5"
}
Project (removed some stuff that was unnecessary):
"dependencies": {
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"#types/jest": "^27.5.2",
"#types/node": "^16.11.43",
"#types/react": "^18.0.15",
"#types/react-dom": "^18.0.6",
"aab-react-emerald": "file:../../aab-react-emerald",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"styled-components": "^5.3.5",
"typescript": "^4.7.4",
"web-vitals": "^2.1.4"
},
Does anyone know where I should look?
Tried every possible solutions I found in internet. I upgraded all the dependencies and packages using yarn - below from package.json
"dependencies": {
"#date-io/date-fns": "^1.3.13",
"#date-io/moment": "^1.3.13",
"#material-ui/core": "^5.0.0-beta.2",
"#material-ui/icons": "^5.0.0-beta.1",
"#material-ui/lab": "^5.0.0-alpha.41",
"#material-ui/pickers": "^4.0.0-alpha.12",
"#material-ui/styles": "^5.0.0-beta.2",
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"axios": "^0.21.1",
"date-fns": "^2.22.1",
"moment": "^2.29.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
}
Before upgrading packages I used:
import {
MuiPickersUtilsProvider,
KeyboardDatePicker,
} from '#material-ui/pickers';
After then I imported these:
import LocalizationProvider from '#material-ui/lab/LocalizationProvider';
import AdapterDateFns from '#material-ui/lab/AdapterDateFns';
and tried below code:
<LocalizationProvider dateAdapter={AdapterDateFns}>
<Grid container justifyContent="space-around">
<DatePicker
disableToolbar
variant="inline"
format="DD/MM/yyyy"
margin="normal"
label="Date"
name="date"
value={values.date}
onChange={(date) => handleInputChange(convertToDefault(date))}
/>
</Grid>
</LocalizationProvider>
Can you help me out? It's quite hassle :/
use this version works fine for me...yarn add #material-ui/core#4.11.4 #material-ui/pickers
"#material-ui/core": "4.11.4",
"#material-ui/pickers": "^3.3.10",
- import { fade } from '#material-ui/core/styles';
+ import { alpha } from '#material-ui/core/styles';
const classes = makeStyles(theme => ({
- backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity),
+ backgroundColor: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity),
}));
Hi I don't think it's a part of #material-ui/pickers any more.
You can check this https://github.com/mui-org/material-ui-pickers/issues/2157
For me its working fine with exact these version. Use the exact same versions and thanks me later. If it not allowed you installation then use --force flag.
"#material-ui/core": "^4.11.4",
"#material-ui/pickers": "^3.3.10",
You cannot use 'fade' from material-ui anymore, as this is deprecated. You can use 'alpha' instead.
Screenshot of error log
I tried to installed it without mentioning the version 5.0.7 and it installed properly.
Here are my dependencies:
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-popper": "^1.3.7",
"react-router-dom": "^4.2.2",
"react-scripts": "1.1.4",
"redux": "^3.7.2"