0.1.0 • Published 9 months ago
react-session-debugger v0.1.0
React Session Debugger
A development tool for debugging session storage in React applications.
Installation
npm install react-session-debugger
or
yarn add react-session-debugger
or
bun add react-session-debugger
Usage
import { SessionStorageDebugger } from "react-session-debugger";
import { z } from "zod";
// Optional: Define your own schema
const schema = z.object({
name: z.string(),
email: z.string().email(),
});
export default function App() {
return (
<div>
{/* Your app content */}
{process.env.NODE_ENV === "development" && (
<SessionStorageDebugger
schema={schema}
defaultValue={{ name: "", email: "" }}
storageKey="myData"
/>
)}
</div>
);
}
Props
schema
: (optional) A Zod schema for validating the JSON datadefaultValue
: (optional) Default value to show in the editorstorageKey
: (optional) Key to use for sessionStorage (default: "userData")
Development
Only shows in development mode (NODE_ENV === "development"
). Now the code blocks should be properly formatted. Let me know if you'd like any changes to the content!
0.1.0
9 months ago