Encode is a web application that allows users to write, edit, and preview HTML, CSS, and JavaScript code in real-time. With this tool, users can quickly test and refine their code, without having to set up a local development environment.
- Live Site URL: https://encode-rahul.vercel.app/
- React.js - JS library
- Tailwind CSS - For styles
- Custom Hooks
import { useEffect, useState } from "react";
export function useLocalStorage(key, initialValue) {
const keyName = "ENCODE-" + key;
const [storedValue, setStoredValue] = useState(() => {
const item = localStorage.getItem(keyName);
return item ? JSON.parse(item) : initialValue;
});
useEffect(() => {
localStorage.setItem(keyName, JSON.stringify(storedValue));
}, [keyName, storedValue]);
return [storedValue, setStoredValue];
}