ReactJS <Errors> component not defined? - reactjs

So I am trying to use the Errors component in my code, taken from
https://davidkpiano.github.io/react-redux-form/docs/api/Errors.html
But VSCode is telling me that Errors is not defined, so I tried importing it like import { Errors } from 'reactstrap'; which makes the error go away but when running the website with yarn start I get "Attempted import error: 'Errors' is not exported from 'reactstrap'."
Any ideas?

Errors is provided in the react-redux-form package, so you need to import that module from the place where it's defined:
import { Errors } from 'react-redux-form';

Related

Attempted import error in react when importing Typogaphy and TexxtField from MUI

I work in a group project in gitlab, and when i try to run yarn dev for my react project I get the following error:
Attempted import error: '#mui/material/Typography' does not contain a default export (imported as 'Typography').
And the same error from TextField
This is how I import Typograpgy:
import Typography from '#mui/material/Typography';
Other imports works fine, but not TextField and Typography
Does anyone know the solution for this problem? I am the only one in the group that gets this error
I have tried to import by using
import {Typography} from '#mui/material'
instead, but that doesn't work either
I remember that I got a similar issue using material ui, one default export cannot be found and I fixed it by deleting node_modules folder and run :
npm install

How to resolve 'react-dnd-html5-backend' does not contain a default export?

I'm new to React and trying to emulate the Row Drag & Drop code found here: https://react-table-omega.vercel.app/docs/examples/row-dnd
If I open the sandbox, all the default code works fine. If I copy-paste the code locally though, I get the following error when I compile:
Attempted import error: 'react-dnd-html5-backend' does not contain a default export (imported as 'HTML5Backend')
I installed the library using npm install react-dnd-html5-backend --save and haven't modified anything with respect to it.
The import line is:
import HTML5Backend from 'react-dnd-html5-backend'
which is copy-pasted from the tutorial. I don't understand why it's throwing an error, nor how to fix it. Any thoughts?
The solution seems to be that the HTML5Backend part needs to be wrapped in braces { HTML5Backend }:
import { HTML5Backend } from 'react-dnd-html5-backend'
is correct
import HTML5Backend from 'react-dnd-html5-backend'
is not.

Error when importing from semantic-ui-react

I am trying to import elements from react semantic ui like this after installing via npm.
import React, { Component } from "react";
import "./App.css";
import { Button } from "semantic-ui-react";
class App extends Component {
render() {
return <Button>hi</Button>;
}
}
export default App;
But i get this error.
I guess the app was already running when you installed semantic-ui package, therefore, the appropriate file were not loaded.
Keep in mind to restart your app after installing every package or simply stop it before installing.
There are two possible scenarios for this error:
1.Hot module reload not working: Sometimes the npm does not automatically reload the pages, so re-starting the app would solve this problem.
2.Yarn / NPM mismatch: Some packages (especially semantic-ui) throws error when there is a mismatch with package-json and yarn.lock. It is recommended to stick with yarn package manager if you are using yarn.
Hope this helps :)

How to integrate Google & Facebook login Using React native

I have referred this documentation to add google-signin in my react native app, followed all the steps mentioned but could not get the result as specified in the documentation. I have imported the following statement
import { GoogleSignin, GoogleSigninButton, statusCodes } from 'react-native-google-signin';
But Whenever I add this statement in my login file it gives me following error.
i think you need make some changed in your file path shown in error message
F:\ReactProjects\SearchApp\node_modules\react-native-google-signin\src\GoogleSignin.android.js
make sure you import following two lines correctly
import React, { Component } from 'react';
import PropTypes from 'prop-types';
install this and your problem goes away "npm install --save prop-types"

React Native: 'undefined is not an object (evaluating '_react3.PropTypes.bool')

I have recently tried to export my react native project to expo. Although, it had updated react-native, and now get an error of 'undefined is not an object (evaluating '_react3.PropTypes.bool')'
I have looked to solve this and found that I need to import proptypes - import PropTypes from 'prop-types'; which ive added in all my scripts, still the error message persists. Moreover, I dont use any proptypes, so I dont get why i would get this error in the first place.
If you would like to take a look at the proj, please do - https://github.com/rasselll/probs
The error is clearly mentioned in the log and is due to react-native-view-transformer library.
The library still uses the PropTypes package from react. Since your react version is higher that v15.5 therefore it is giving an error.
Here's a file from the package that is still using the deprecated version of propTypes

Resources