Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@uiw/react-head
Advanced tools
React components will manage your changes to the document head, like react-helmet
npm install @uiw/react-head
import React, { useState } from "react";
import Head from '@uiw/react-head';
export default function App() {
const [count, setCount] = useState(1);
const click = () => setCount(count + 1)
return (
<div className="container">
<Head>
<Head.Meta charSet="utf-8" />
<Head.Title>{count} React Head</Head.Title>
<Head.Link rel="canonical" href="https://uiwjs.github.io" />
</Head>
<button onClick={click}>
Switch Title - "{count}"
</button>
</div>
);
}
import React, { useState } from "react";
import Head from '@uiw/react-head';
const css = `.box-test { color: red; }`
export default function App() {
return (
<div>
<Head.Style>{css}</Head.Style>
<Head>
<Head.Style>{css}</Head.Style>
</Head>
<div className="box-test">Text Color</div>
</div>
);
}
outputs:
<head>
<style>.box-test { color: red; }</style>
<style>.box-test { color: red; }</style>
</head>
<!-- .... -->
import React, { useState } from "react";
import Head from '@uiw/react-head';
export default function App() {
const [count, setCount] = useState(1);
const click = () => setCount(count + 1)
return (
<div>
<Head.Meta name="keywords" content="react-head,uiw,uiwjs" />
<Head.Meta charSet="utf-8" />
<Head.Meta name="description" content={`${count} React components will manage your changes to the document head.`} />
<button onClick={click}>
Modify Meta name=description - "{count}"
</button>
</div>
);
}
Outputs:
<head>
<meta name="keywords" content="react-head,uiw,uiwjs">
<meta name="description" content="1 React components will manage your changes to the document head.">
</head>
<Head.Link rel="icon" href="/favicon.ico" />
<Head.Link rel="icon" type="image/svg+xml" href="/favicon.svg" />
import React, { useState } from "react";
import Head from '@uiw/react-head';
const favicon = `data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🦖</text></svg>`
const favicon2 = `data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🤡</text></svg>`
export default function App() {
const [show, setShow] = useState(false);
return (
<div>
<Head.Link rel="icon" type="image/svg+xml" href={show ? favicon : favicon2} />
<button onClick={() => setShow(!show)}>
Change Favicon {show ? "🦖" : "🤡"} {String(show)}
</button>
</div>
);
}
Outputs:
<head>
<link data-head="true" rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🤡</text></svg>" />
</head>
Elements that can be used inside the <head>
:
<title>
-> <Head.Title>
<base>
-> <Head.Base>
<link>
-> <Head.Link>
<style>
-> <Head.Style>
<meta>
-> <Head.Meta>
npm install
npm run build # Compile packages 📦 @uiw/react-head
npm run watch # Real-time compilation 📦 @uiw/react-head
npm run start
test/
folder) and submit a pull request.npm run test
As always, thanks to our amazing contributors!
Made with contributors.
Licensed under the MIT License.
FAQs
React components will manage your changes to the document head
The npm package @uiw/react-head receives a total of 310 weekly downloads. As such, @uiw/react-head popularity was classified as not popular.
We found that @uiw/react-head demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.