Skip to content

fix: preventing unnecessary re-renders in react component by switching to function invocation #2070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

Conversation

sanbondeveloper
Copy link

@sanbondeveloper sanbondeveloper commented Dec 6, 2024

Please provide enough information so that others can review your pull request:

Motivation

To solve the infinite re-rendering issue when rendering content as a JSX element in a React component, I changed the approach to directly call the content as a function. Rendering as a JSX element can lead to React creating a new component instance each time, causing unnecessary re-renders. By invoking Content as a function, we ensure consistent output for the same input, optimizing performance and preventing redundant re-renders.
Issues

@sanbondeveloper sanbondeveloper changed the title fix: prevent infinite re-rendering when Content is a function fix: preventing Unnecessary Re-renders in React Component by Switching to Function Invocation Dec 6, 2024
@sanbondeveloper sanbondeveloper changed the title fix: preventing Unnecessary Re-renders in React Component by Switching to Function Invocation fix: preventing unnecessary re-renders in react component by wwitching to function invocation Dec 6, 2024
@sanbondeveloper sanbondeveloper changed the title fix: preventing unnecessary re-renders in react component by wwitching to function invocation fix: preventing unnecessary re-renders in react component by switching to function invocation Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant