question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lambdas are forbidden in JSX attributes due to their rendering performance impact

See original GitHub issue

i got “Lambdas are forbidden in JSX attributes due to their rendering performance impact”

but in my tsconfig.json, i already added “jsx-no-lambda”: false

{
	"compilerOptions": {
		"baseUrl": ".",
		"outDir": "build/dist",
		"module": "esnext",
		"target": "es5",
		"lib": ["es6", "dom"],
		"sourceMap": true,
		"allowJs": true,
		"jsx": "react",
		"moduleResolution": "node",
		"rootDir": "src",
		"forceConsistentCasingInFileNames": true,
		"noImplicitReturns": true,
		"noImplicitThis": true,
		"noImplicitAny": true,
		"strictNullChecks": true,
		"suppressImplicitAnyIndexErrors": true,
		"noUnusedLocals": true
	},
	"rules": {
		"jsx-no-lambda": false
	},
	"exclude": [
		"node_modules",
		"build",
		"scripts",
		"acceptance-tests",
		"webpack",
		"jest",
		"src/setupTests.ts"
	]
}

please help

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

14reactions
gaearoncommented, Aug 1, 2018

There’s nothing technically wrong with using lambdas in JSX.

There are some cases where it matters but I suggest fixing them on case-by-case basis.

The issue usually has nothing to do with function being created on render. It’s about PureComponents below not being able to use a shallow comparison (because the function prop is always new).

1reaction
kimhjonacommented, Jul 27, 2018

@peterremote1980 This is something I ran into recently. You’ll need to recompile your project to see those updates (npm start or yarn start again)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lambdas are forbidden in JSX attributes due to their rendering ...
Exactly what that message indicates - you're using a lambda inside a JSX attribute in render . The jsx-no-lambda rule of tslint-react is...
Read more >
Lambdas are forbidden in JSX attributes due to their rendering ...
'values' implicitly has an 'any' type. This error simply means that TypeScript can't figure out the type of the parameter values on its...
Read more >
Typescript and React: Lambdas are forbidden? - Jon Hilton
Lambdas are forbidden in JSX attributes due to their rendering ... them unequal values and force the component to re-render more often than ......
Read more >
Reactjs – Are Lambda in JSX Attributes an anti-pattern
"Lambdas are forbidden in JSX attributes due to their rendering performance impact" ... Lambdas (arrow functions) have no impact on rendering performance.
Read more >
Lambdas are forbidden in JSX attributes due to their rendering ...
Coding example for the question Lambdas are forbidden in JSX attributes due to their rendering performance impact-Reactjs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found