DiamondLightSource / logpanel

Graylog frontend that displays aggregated, streaming logs for multiple services
Apache License 2.0
1 stars 0 forks source link

Redux Implementation #7

Open TBThomas56 opened 5 months ago

callumforrester commented 4 months ago

This is where my react knowledge fails me, I get the impression that redux becomes necessary for sanity maintenance once a project reaches a certain level of complexity, but not sure how best to determine when we've reached that point! @abigailalexander do you have any thoughts?

abigailalexander commented 4 months ago

The main use case for Redux is when you have many different components needing to access the same state - using the normal React way this often ends up with high level components accessing state and passing it down via props to all of the children who need it. This can get quite confusing and involve passing state through a lot of props that don't actually need it. You also have to keep track of state manipulation, because there isn't a single "source of truth" for the state. At a quick glance it seems like here the state is confined to the Table components, so you could manage just fine without adding the complexity of Redux into the project (at least at this point!). It seems like the only overlap of state between components would be the log filter and the table, though feel free to correct me if I'm wrong.

My approach to Redux is to try doing everything you need first without it, and then if it gets complicated to pass state between many components you add it in.

callumforrester commented 4 months ago

Thanks, that helps a lot!