- JSON Formatter/Viewer
Format, minify, visualize and validate JSON.
- JSON Diff
Compare two JSON objects.
- JSON Schema Validator
Validate JSON schema online
- Base64 Encode/Decode
Encode and decode Base64.
- URL Encode/Decode
Encode and decode URL.
- UUID Generator v4 / v1
Generate UUIDs in v4 and other versions.
- Text Hash
Generate cryptographic hashes from your text input using a wide variety of algorithms.
- File Hash
Generate cryptographic hashes from your file using a wide variety of algorithms.
- JWT Decoder & Validator
Decode and validate JSON Web Tokens.
- CSV Viewer
View CSV data in a table.
- CSV to JSON Converter
Convert CSV to JSON.
- JSON to CSV Converter
Convert JSON to CSV.
React Local Storage
This snippet provides an introduction to using local storage with React, a popular JavaScript library for building user interfaces.
const [data, setData] = useState(localStorage.getItem('myData') || ''); useMemo(() => {localStorage.setItem('myData', data);}, [data]);
In this code snippet, we are defining a state variable 'data' that initially retrieves and stores data from the localStorage using the key 'myData'.
The useMemo hook is then used to set the localStorage with current state of 'data' whenever 'data' changes. This essentially stores user input data in the localStorage for that session.
By using localStorage in this manner with React, you can effectively persist user data across different browser sessions.