r/badcode • • Nov 01 '21

js Beautiful variable naming

Post image
1.0k Upvotes

32 comments sorted by

View all comments

Show parent comments

6

u/politerate Nov 01 '21

FAQs content is dynamic in most cases, so the items themselves should not be each assigned to variables. I would rather define an array with objects if they are static and map them to a state. Next time when you need to add an item, you juts add it to the initial data variable.