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.

how to prevent "no state change view render func" execute

See original GitHub issue

my 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hongmomanucommented, Jan 5, 2018

@JorgeBucaran tks again,i get it! by the way, your lib is amazing! i will close the issues.

0reactions
jorgebucarancommented, Jan 5, 2018

Awesome and thanks! 🎉

Read more comments on GitHub >

github_iconTop 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 >

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