The React components for the Courier web UI
npm install @trycourier/courier-reactUsing React 17? Use the @trycourier/courier-react-17 package.
Not using React? Use the @trycourier/courier-ui-inbox package.
``sh`
npm install @trycourier/courier-react
Check out the Courier documentation for a full guide to Courier React.
If you’re coming from an earlier version of the Courier React SDK,
check out the v8 migration guide
for what’s changed, how to upgrade your app,
and links to documentation for past versions of the React SDK.
Below are a few examples of the Courier Inbox. Visit the Courier documentation for more examples.
`ts
import { useEffect } from 'react';
import { CourierInbox, useCourier } from '@trycourier/courier-react';
export default function App() {
const courier = useCourier();
useEffect(() => {
// Generate a JWT for your user (do this on your backend server)
const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Replace with actual JWT
// Authenticate the user with the inbox
courier.shared.signIn({
userId: $YOUR_USER_ID,
jwt: jwt,
});
}, []);
return
}
`
`ts
import { useEffect } from 'react';
import { CourierInbox, useCourier } from '@trycourier/courier-react';
export default function App() {
const courier = useCourier();
useEffect(() => {
// Generate a JWT for your user (do this on your backend server)
const jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'; // Replace with actual JWT
// Authenticate the user with the inbox
courier.shared.signIn({
userId: $YOUR_USER_ID,
jwt: jwt,
});
}, []);
return (
}
``
Have an idea or feedback about our SDKs? Let us know!
Open an issue: Courier Web Issues