CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-react-addons-shallow-compare

Legacy React addon for performing shallow comparison of props and state to optimize component rendering performance

Overall
score

99%

Overview
Eval results
Files

rubric.jsonevals/scenario-2/

{
  "context": "This criteria evaluates how well the engineer uses the react-addons-shallow-compare package to implement performance optimization in a React component. The focus is on correct usage of the shallowCompare function within the shouldComponentUpdate lifecycle method to prevent unnecessary re-renders.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Imports shallowCompare",
      "description": "Correctly imports the shallowCompare function from the react-addons-shallow-compare package using either ES6 import or CommonJS require syntax",
      "max_score": 15
    },
    {
      "name": "Implements shouldComponentUpdate",
      "description": "Implements the shouldComponentUpdate lifecycle method in the UserProfile class component with the correct signature (nextProps, nextState)",
      "max_score": 20
    },
    {
      "name": "Uses shallowCompare correctly",
      "description": "Calls shallowCompare(this, nextProps, nextState) within shouldComponentUpdate and returns its result, passing the component instance as the first argument",
      "max_score": 35
    },
    {
      "name": "Correct comparison logic",
      "description": "The shallowCompare function is used as the sole determinant for whether the component should update, without additional custom comparison logic that would override or interfere with the shallow comparison",
      "max_score": 20
    },
    {
      "name": "Proper return value",
      "description": "The shouldComponentUpdate method returns the boolean result from shallowCompare without modification or inversion, ensuring true means update and false means don't update",
      "max_score": 10
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/npm-react-addons-shallow-compare

tile.json