Refactor: Access props from a single props argument#797
Refactor: Access props from a single props argument#797mfisher87 wants to merge 3 commits intogeojupyter:mainfrom
Conversation
I feel that while this is more verbose, it reduces cognitive load when reading the component code. Previously, in order to know where a value comes from (i.e. props vs state), I needed to remember the names of all the props. With this change, I don't need to know that because I can see the value is accessed from the props object.
|
Integration tests report: appsharing.space |
|
I vote for destructuring props. |
|
Thanks for the input Greg! Can you provide the reasoning behind your vote? The reason I felt this change was important is because I find destructuring is increasing the cognitive load of reading the code. I have to remember the names of props to know they are props. I feel readability is one of the most important attributes of a codebase, as code is written once and read many times. Cognitive load is one of the most important variables that contributes to readability, as it's a very limited resource (https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two). For example, reading the |
Description
I feel that while this is slightly more verbose, it reduces cognitive load when reading the component code. Previously, in order to know where a value comes from (i.e. props vs state), I needed to remember the names of the props. With this change, I don't need to know that because I can see the value is accessed from the props object.
This work was done by Claude, as it's a pretty rote and boring task not really worth spending human hours on. I haven't fully reviewed and applied my judgement, which is why this is still a draft. I'd like your input before I fully review and tweak this work for merge -- is this a change we agree we want?
@martinRenou @arjxn-py @gjmooney ? 🙏
Checklist
Resolves #XXX.Failing lint checks can be resolved with:
pre-commit run --all-filesjlpm run lint📚 Documentation preview: https://jupytergis--797.org.readthedocs.build/en/797/
💡 JupyterLite preview: https://jupytergis--797.org.readthedocs.build/en/797/lite