This repository has been archived by the owner on Sep 26, 2023. It is now read-only.
Improve the rendering from localStorage: currently re-renders everything on the page #5
Labels
Milestone
The project is currently re-rendering the transaction list when a new one is added, or when you update a bill to "paid".
This is because I wrote it based on some articles I found about handling data and the DOM with localStorage and vanilla JS.
There is a better way:
Array
as a middleman to both: add/remove/update information in localStorage, and also topush
,pop
, or update information from the DOM.Here's how I envision this working...
Adding bills:
We probably have to grab identifiers for each child element (that has data) of the
.tx
elements to update the data individually.Maybe this will require to break it down into small bits of functions, like:
updateAmount(amount)
, which is called within theupdateBill()
function conditionally if the data has been updated.If you've got a better idea on how to handle this, feel free to share.
PS:
Yes, I know this would all be easier if we used a library that can handle states, like React, or Vue... I am personally not willing to move into a library like that, mostly because I am not comfortable coding with these libraries.
It would slow me down, and I want the tool to work. I really want to be able to use it.
But you're free to fork it and do it! I would love that, and would use it to learn a new skill. ❤️
LMK if you do.
The text was updated successfully, but these errors were encountered: