compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/component.js JAVASCRIPT 33 lines View on github.com → Search inside
1function Component(props) {2  const items = props.items;3  const maxItems = props.maxItems;45  const renderedItems = [];6  const seen = new Set();7  const max = Math.max(0, maxItems);8  for (let i = 0; i < items.length; i += 1) {9    const item = items.at(i);10    if (item == null || seen.has(item)) {11      continue;12    }13    seen.add(item);14    renderedItems.push(<div>{item}</div>);15    if (renderedItems.length >= max) {16      break;17    }18  }19  const count = renderedItems.length;20  return (21    <div>22      <h1>{count} Items</h1>23      {renderedItems}24    </div>25  );26}2728export const FIXTURE_ENTRYPOINT = {29  fn: Component,30  params: ['TodoAdd'],31  isComponent: 'TodoAdd',32};

Code quality findings 1

Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (item == null || seen.has(item)) {

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.