CodingNic

Navigation and Persistence

Save Conversion History

Navigation and Persistence 30 min read

Save Conversion History

Save Conversion History

Open components/Converter.js.

Create a history record containing:

  • from
  • to
  • amount
  • result
  • date

Write the newest record to the front of the existing localStorage array and cap the list to a reasonable size.

Test it

Run several conversions, open /history, and verify the newest conversion appears first.

Checkpoint

The converter now creates durable browser history records.