New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-ua

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-ua - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

10

package.json
{
"name": "react-ua",
"version": "0.0.2",
"version": "0.1.0",
"description": "React User Agent component and provider with new React Context API",

@@ -22,6 +22,3 @@ "main": "dist/react-ua.js",

"jest": {
"testEnvironment": "jsdom",
"setupFiles": [
"jest-localstorage-mock"
]
"testEnvironment": "jsdom"
},

@@ -34,3 +31,4 @@ "repository": {

"react",
"localstorage"
"user agent",
"ua-parser-js"
],

@@ -37,0 +35,0 @@ "author": "Antony Budianto <antonybudianto@gmail.com>",

27

README.md

@@ -6,4 +6,10 @@ # react-ua

User Agent Component and Provider, wrapper for [ua-parser-js](https://github.com/faisalman/ua-parser-js), SSR-ready, using new React Context API
React User Agent Component and Provider, SSR-ready, using new React Context API
## Features
- Wrapper for [ua-parser-js](https://github.com/faisalman/ua-parser-js)
- Using new React [Context API](https://reactjs.org/docs/context.html)
- SSR-ready
> Try it [live at StackBlitz](https://stackblitz.com/edit/demo-react-ua)

@@ -15,2 +21,8 @@

class App extends Component {
render() {
return <UserAgent>{ua => <div>OS: {ua.os.name}</div>}</UserAgent>;
}
}
class Home extends Component {

@@ -22,4 +34,4 @@ state = {

return (
<UserAgentProvider value={window.navigator.userAgent}>
<UserAgent>{ua => <div>OS: {ua.os.name}</div>}</UserAgent>
<UserAgentProvider>
<App />
</UserAgentProvider>

@@ -29,2 +41,11 @@ );

}
// SSR
const el = (
<UserAgentProvider value={request.headers['user-agent']}>
<App />
</UserAgentProvider>
);
renderToString(el);
```

@@ -31,0 +52,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc