Doesn't detect changes for functions that generate DOM component changes
See original GitHub issueI have a component which has a class. I have noticed that reloading does not work if a function contained in a component has code which is changed. Example:
class MainApp extends Component
{
constructor(props)
{
super(props);
this.DOM =
{
G : // generator functions
{
contactButton : (p)=>
{
return (
<Button className={this.classes.contactButtonContainer}
onClick={()=> {location.href = p.url}}>
<i className={p.className}/>
</Button>
);
}
}
};
}
render ()
{
return (
<div className="appWrapper">
<div className="mainContent">
<AppHeader/>
<div>- insert body content here -</div>
</div>
<div className="appFooter">
{this.DOM.G.contactButton(
{
className : 'mdi mdi-github-box',
url : 'http://somewhere'
})}
{this.DOM.G.contactButton(
{
className : 'rc3 rc3-npm-box',
url : 'http://somewhere'
})}
{this.DOM.G.contactButton(
{
className : 'mdi mdi-code-tags',
url : 'http://somewhere''
})}
</div>
</div>
);
}
}
If I edit the definition of this.DOM.G.contactButton
, no changes are detected when reloading. Also to note, I am using Redux & ReactRouter (@next/latest for each). I was very careful to set up each and require the proper middleware, but I’m not sure if this is an issue with that at this point.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (5 by maintainers)
Top Results From Across the Web
Detect changes in the DOM - javascript - Stack Overflow
I want to execute a function when some div ...
Read more >Angular Change Detection - How Does It Really Work?
By default, Angular Change Detection works by checking if the value of template expressions have changed. This is done for all components. We ......
Read more >How JavaScript works: tracking changes in the DOM using ...
MutationObserver is a Web API provided by modern browsers for detecting changes in the DOM. With this API one can listen to newly...
Read more >The Last Guide For Angular Change Detection You'll Ever Need
This mechanism of syncing the HTML with our data is called "Change Detection". Each frontend framework uses its implementation, e.g. React uses Virtual...
Read more >Simplified Angular Change Detection | by Pankaj Parkar | ngconf
Implementation of the tick method looks pretty simple. It basically loops over each view (components are internally referred to as view) and calls...
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
Just got merged 😊
Thanks for the thoughtful reply. I have actually resorted to doing just that. One reason why I had done things this way is
material-ui
now uses JSS and has to be compiled with a context binded to the style for classNames (I mean, I don’t have to use JSS, but for the sake of consistency within these apps). I’m not sure if the technology within JSS that re-writes CSS to the DOM would have slowdown with more sheets generated per render to do that.But I guess a little more boiler-plate here and there won’t be the end of the world. Thanks 😄 👍