score:5

Accepted answer

Quick answers to your questions:

Is it a bad practice to store data in the state that will not change, and remain constant?

Somewhat, yes. The state is meant to store the current "state" of your UI. If a specific UI component never changes it doesn't really make sense to talk about "states", because there is only one.

Will using state for constants effect performance?

No.

If there a reason to store data that won't change within the state, If I do have state elsewhere, is it easier to just use the state for everything?

There isn't really, but even if it was considered a valid practice, I would argue that you are sacrificing readability and structure in your code because you wouldn't be distinguishing between the static and dynamic stuff in your UI.


Based on the snippets provided, I would strongly suggest either (2) or (3). I would consider both of these good practices depending on where you want to store the data (within or outside your component) and if flexibility is important.


Related Query

More Query from same tag