With this code snippet, you can use Ionicons in your React + TypeScript project with code completion and without any errors from React side.
- Copy the content of the
ion-icons.d.ts
file. - Add scripts inside your
<head>
tags.
<head>
<!-- ... -->
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
<script nomodule src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.js"></script>
</head>
(For latest versions and usage, please check https://ionic.io/ionicons/usage)
That's it. You can start using Ionicons!
const MyComponent: React.FC = () => {
return (
<span>People <ion-icon name="people-outline" /> </span>
)
}