Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP2stack specificStack: react
reactpropsconsistencyreadability
Destructure props consistently within a component
Destructure props at the top of render (or consistently across methods) rather than mixing destructured access in some methods and this.props.x in others.
PR: frontpage-web · org-mining-hist-2026-06Created: Jun 18, 2026
Bad example
Old codetsx
| 1 | render() { |
| 2 | return <div>{this.props.view}</div>; |
| 3 | } |
| 4 | renderEdit() { |
| 5 | const { onSave } = this.props; |
| 6 | } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetsx
| 1 | render() { |
| 2 | const { view } = this.props; |
| 3 | return <div>{view}</div>; |
| 4 | } |
Explanation (EN)
Objašnjenje (HR)