How to use bootstrap-notify in react - reactjs

i want to use http://bootstrap-notify.remabledesigns.com/ in my react app, i have tried to follow Using bootstrap-notify with Angular 7 but getting error "$.notify is not a function" in console

You need the necessary imports:
import $ from "jquery";
import "bootstrap-notify";
You will need to load them using npm i jquery --save and npm i bootstrap-notify --save. I also had some compiler errors after installing, which I fixed with: (see here)
npm install --save --save-exact react-scripts#3.4.0

Related

Cannot use MUI 'ContentCopy' icon

I am trying to use the icon 'ContentCopy' from MUI.
https://mui.com/components/material-icons/ says to use the following import:
import ContentCopyIcon from '#mui/icons-material/ContentCopy';
No matter what I do, I get the error:
Module not found: Can't resolve '#mui/icons-material/
I have already tried the following:
npm install #material-ui/core
npm install #material-ui/icons
I also tried deleting my node-modules and re-running npm install.
Any ideas on what else I could try??
It seems that you confused of using version 4 and 5.
You need to install the icons of version 5.
npm install #mui/icons-material
And import the icon from the module.
import ContentCopyIcon from '#mui/icons-material/ContentCopy';
Please refer to this.
to version 5 you need to install mui
npm install #mui/icons-material
mui contains all the icons
from '#mui/icons-material/_';
info https://www.npmjs.com/package/#mui/icons-material

Meteor-React tutorial: missing step to install Babel package

I'm following the official Todo App with React tutorial. If I follow the steps exactly, after step 2.5, I get an error:
=> Exited with code: 1
Unable to resolve some modules:
"#babel/runtime/helpers/interopRequireDefault" in
/.../todos/imports/ui/App.js (web.browser.legacy)
"#babel/runtime/helpers/inheritsLoose" in
/.../todos/imports/ui/App.js (web.browser.legacy)
If you notice problems related to these missing modules, consider running:
meteor npm install --save #babel/runtime
It seems that the current versions of Meteor and the React npm package do not automatically install Babel, so JSX code is not converted to JS.
It would make life easier for others who want to follow this tutorial if the commands ...
meteor npm install --save react react-dom
meteor npm install --save #babel/runtime
... were given together.

Can't find variable: PropTypes

I am trying some react native code.
Added props for my component based on the instructions given in this blog.
End up in the error, Can't find variable: PropTypes
Found the same question in github but it was closed without any answers
Couldn't get any clues.
You need to do install prop-types with npm install --save prop-types or yarn add prop-types and then add this to your code:
import PropTypes from 'prop-types';
Make sure prop-types is installed:
npm install --save prop-types
Make sure the following line is added in the file where the error originated
import PropTypes from 'prop-types'; .
Ok, so I was having a similar issue when configuring my react router (react-router-dom),
then I realized I used YARN to add react, react-dom and prop-types, and NPM to add the react-router-dom, then I got suspicious it was this the problem and I:
removed it with:
npm uninstall react-router-dom
and installed it with:
yarn add react-router-dom --dev
and it stopped giving me the error / fixed it.

Moment in typescript not recognized?

I ran these commands:
npm install tsd -g
tsd install moment --save
it is also injecting into my module but when i am accessing it it is not recognizing moment.
eg.
import * as moment from 'moment';
Could you please help me out.
Try this .
npm install #types/moment --save-dev
It is best to install the typescript definition files as developer dependencies
Then import like this
import * as moment from "moment"

TypeScript error: duplicate identifier, React definition files

I work on Webstorm and I try to compile via TypeScript *.tsx.
I put react folder at the root of my project.
I imported react with the relevant typescript command.
While I tsc I get the following error:
react-definition/react.d.ts(2267,9): error TS2300: Duplicated identifier 'tspan'.
and it's pointing files in the react-definition folder.
UPDATE:
here is the code:
import * as react from "react-definition"
<div>
<Check/>
</div>
Can anyone help?
If you are using npm in your project, you can run the following commands (in console or terminal) to automatically add typescript definition files for react:
npm install --save-dev #types/react
npm install --save-dev #types/react-dom
Then, when importing in your code:
import * as React from 'react';
If you are not using npm already, you should initialize your project using npm. Run the following commands in your terminal or console, while in your project folder:
npm init
npm install --save react react-dom
npm install --save-dev typescript

Resources