how to prevent "no state change view render func" execute
See original GitHub issuemy english is poor ,the case is when i have a main view like:
export const view = (state, actions) =>
<div class='container'>
<MyHeader />
<h1>{state.count}</h1>
<AddButton actions={actions} />
<SubButton actions={actions} />
</div>
export const MyHeader = () =>{
console.log('MyHeader');
return <header>
<h2>hyperapp is cool </h2>
</header>
}
if i use action to change the count state , the ‘MyHeader’ will always execute , is it reasonable? if it is not ,how to prevent?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to prevent re-rendering of components that have not ...
In the above if you change Text, there is not State change in App, so Button doesn't get re-rendered, no need for useMemo...
Read more >5 Ways to Avoid React Component Re-Renderings
4. Replace useState() with useRef() ... useState() Hook is widely used in React applications to re-render the components on state changes. However, there...
Read more >Rendering and Updating Data using Component Lifecycle ...
In this guide, we will learn several approaches to execute JavaScript after the render() method, including using initial render to fetch the ...
Read more >Hooks FAQ - React
Are Hooks slow because of creating functions in render? How to avoid passing callbacks down? How to read an often-changing value from useCallback?...
Read more >What Every React Developer Should Know About State
One of the most important concepts for every React developer to understand is state – what it is, how to properly use it,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@JorgeBucaran tks again,i get it! by the way, your lib is amazing! i will close the issues.
Awesome and thanks! 🎉