React component
Add real-time chat to your React app in minutes with TalkJS. Our fully-featured chat solution includes customizable pre-built UIs, cross-platform notifications, and flexible theming — no backend setup required.
import { useCallback } from "react";
import Talk from "talkjs";
import { Session, Chatbox } from "@talkjs/react";
function ChatComponent() {
const syncUser = useCallback(
() =>
return new Talk.User({
id: "nina",
name: "Nina",
email: "nina@example.com",
photoUrl: "https://talkjs.com/new-web/avatar-7.jpg",
welcomeMessage: "Hi!",
role: "default",
}),
[],
);
const syncConversation = useCallback((session) => {
// JavaScript SDK code here
const conversation = session.getOrCreateConversation("welcome");
const other = new Talk.User({
id: "frank",
name: "Frank",
email: "frank@example.com",
photoUrl: "https://talkjs.com/new-web/avatar-8.jpg",
welcomeMessage: "Hey, how can I help?",
role: "default",
});
conversation.setParticipant(session.me);
conversation.setParticipant(other);
return conversation;
}, []);
return (
<Session appId="<APP_ID>" syncUser={syncUser}>
<Chatbox
syncConversation={syncConversation}
style={{ width: "100%", height: "500px" }}
></Chatbox>
</Session>
);
}
export default ChatComponent;


TalkJS is a developer friendly chat API with a pre-built UI that is highly customizable. You can build a chat feature in minutes instead of months.
import { Session, Chatbox } from "@talkjs/react";
<Session appId="t824ba8" userId="pete">
<Chatbox conversation="workshop" className="chatbox"/>
</Session>Get to launch quickly with a high-quality default experience, or make use of all the resources you need to build a custom integration with React.
Get notified for each new message via webhooks, control your data with the REST API, or set up email notifications. And if you could use some support in building that integration, you can instantly chat with a TalkJS developer to get some help with your code.