mem0-react
v0.0.6
Published
React components for mem0
Downloads
3
Readme
mem0-react
A set of styled and ready-to-use React components for mem0.
Includes the User manager component, which allows users to easily view and edit their memories, as well as add new ones. It has everything you need to do CRUD operations on your user's memories with one single component.
Features
- User Manager Component
- Add Memory Component
- Update Memory Component
- Delete Memory Component
Installation
To install dependencies:
npm install mem0-react
To use, in a nextjs app:
Add the environment variable
MEM0_API_KEY
to your.env
file.Add this in the page you wnat to show user memories:
import { Mem0MemoryManager } from 'mem0-react';
export default function Home() {
const userId = session.user.id // Here, make sure that this user is authenticated.
return (
<Mem0MemoryManager
userId={userId}
// The path should be sent so that we can revalidate the page on changes.
path="/"
/>
);
}
What is the path prop for? It's used to automatically revalidate the page when the user's memories change.