Skip to content

dasurahul/encode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Encode

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.

Table of contents

Overview

Screenshot

Links

My process

Built with

What I learned

  • 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];
}

Useful resources

Releases

No releases published

Packages

No packages published