kubarium / react-nbsp Goto Github PK
View Code? Open in Web Editor NEWAdds one or many non-breaking space characters into your JSX
Adds one or many non-breaking space characters into your JSX
I am getting this error while trying to use your library.
TypeError: Cannot read property 'number' of undefined
./node_modules/react-nbsp/lib/ReactNbsp.js
24 | };
25 |
26 | Space.propTypes = {
> 27 | count: _react.PropTypes.number
28 | };
29 |
30 | exports['default'] = Space;
And this is my package.json:
{
"name": "react-redux-todo",
"version": "0.1.0",
"private": true,
"dependencies": {
"prop-types": "^15.6.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-nbsp": "^1.1.1",
"react-redux": "^5.0.7",
"react-scripts": "1.1.1",
"redux": "^3.7.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
I'm using PropTypes in my components and it's all fine. But when I import your library, I keep getting the above error.
Could you please help me to point out what I'm doing wrong? Thanks.
yarn upgrade; yarn audit --groups dependencies
identifies a vulnerability advisory 786. As this is a production dependency, the vulnerability will also show in other packages which depend on react-nbsp.
Current output of yarn audit --groups dependencies
:
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ low │ Regular Expression Denial of Service │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ braces │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=2.3.1 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ webpack-cli │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ webpack-cli > jscodeshift > micromatch > braces │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://www.npmjs.com/advisories/786 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ low │ Regular Expression Denial of Service │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ braces │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=2.3.1 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ webpack-cli │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ webpack-cli > webpack-addons > jscodeshift > micromatch > │
│ │ braces │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://www.npmjs.com/advisories/786 │
└───────────────┴──────────────────────────────────────────────────────────────┘
2 vulnerabilities found - Packages audited: 12206
Severity: 2 Low
Because of this:
do {
space = space.concat('\u00A0')
} while (--count);
If the value of count is not positive, the break condition will never be reached and therefore will cause an infinite loop.
React deprecated the use of PropTypes
from the main package during the 15.x versions and now that 16 has been out, this component no longer works because of that tiny issue. You can support both 15 and 16 if you just change where PropTypes are imported from.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.