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.

componentWillMount and Reflux this.store don't play nice together.

See original GitHub issue

I have an issue, using the ES6 Classes, if I have componentWillMount on my React Component, then the component will not listen to the Store. Can we make both of them work?

Or at least show an error in case the Component doesn’t link to the Store.

I didn’t understood why the Component did not update with the Store’s state and eventually found out that if I have an componentWillMount, the Component will not be linked with the Store.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

8reactions
jamesmarrscommented, Dec 12, 2016

@eek I started reworking some of my old code last week to implement the new es6 features that @BryanGrezeszak was so nice to work on. I ran into some similar problems. If you have componentWillMount and componentWillUnmount in your Reflux.Component you need to add this line inside the function to make sure everything gets bound correctly:

// in your componentWillMount() 
Reflux.Component.prototype.componentWillMount.call(this);
// in your componentWillUnmount()
Reflux.Component.prototype.componentWillUnmount.call(this);

After the new docs were out I was going to check them over to make sure this got in there somewhere, as its easy to miss!

3reactions
BryanGrezeszakcommented, Jan 13, 2017

this is a keyword too, but I can still log the object it references at any given moment. I expected similar behavior from super.

Since I couldn’t access it I just thought that meant the feature wasn’t actually implemented. Oh well, live and learn: JS always has a surprise in store, no matter how much you think you know 😃

But yes, it should remove the need for any call. So that’s even better.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Tutorial — Converting Reflux to Redux | by Matt Star
Reflux — the first attempt:​​ Quick flux refresher from their docs: Following the Reflux pattern, let's declare an action–showFiltersActions–to tell the store ......
Read more >
Understanding State in React Component - Morioh
In React, components are considered first-class citizens and therefore it is essential to be familiar with their inner working mechanism.
Read more >
Functional Web Development with React and Redux
Yes, React is a small library that doesn't come with everything you might ... functions are named well and combined in a way...
Read more >
Index - ReactJS Blueprints - Packt Subscription
Index. A. actions / Creating a data store to fetch the products. about / Understanding actions. alerts. about / Creating responsive alerts.
Read more >
Untitled
Samsung 4s price in india, Lc270, Such a beautiful day film, Godhavi map, ... Biodata mawar febra, Asaps/aserf, Vb6 compare type, Play store...
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