All Questions

130
votes
9answers
42769 views

Unable to access React instance (this) inside event handler

I am writing a simple component in ES6 (with BabelJS), and functions this.setState is not working. Typical errors include something like Cannot read property 'setState' of undefined or th...
48
votes
4answers
2801 views

Javascript object bracket notation ({ Navigation } =) on left side of assign

I haven't seen this syntax before and am wondering what it's all about. The brackets on the left are throwing a syntax error: "unexpected token {" var { Navigation } = require('react-router'); I'm ...
531
votes
23answers
288754 views

Programmatically navigate using react router

With react-router I can use the Link element to create links that are natively handled by react router. I see internally it calls this.context.transitionTo(...). I want to do a navigation, but not ...
208
votes
22answers
93206 views

React-router urls don't work when refreshing or writting manually

I'm using React-router and it works fine while I'm clicking into link buttons, but when I refresh my webpage it does not load what I want. For instance, I am into localhost/joblist and everything is ...
106
votes
4answers
41860 views

How to use arrow functions (public class fields) as class methods?

I'm new to using ES6 classes with React, previously I've been binding my methods to the current object (show in first example), but does ES6 allow me to permanently bind a class function to a class in...
9
votes
2answers
1573 views

Programmatically Navigate using react-router

I am developing an application in which i check if the user is not loggedin I have to display the login form, else dispatch an action that would change the route and load other component.here is my co...
7
votes
2answers
1725 views

Why calling setState method doesn't mutate the state immediately?

Ok, i'll try and make this quick because it SHOULD be an easy fix... I've read a bunch of similar questions, and the answer seems to be quite obvious. Nothing I would ever have to look up in the firs...
7
votes
1answers
1723 views

calling setState doesn't mutate state immediately

I would like to ask why my state is not changing when I do an onclick event. I've search a while ago that I need to bind the onclick function in constructor but still the state is not updating. Here's...
322
votes
6answers
63640 views

Why do we need middleware for async flow in Redux?

According to the docs, "Without middleware, Redux store only supports synchronous data flow". I don't understand why this is the case. Why can't the container component call the async API, and then di...
542
votes
34answers
374238 views

Loop inside React JSX

I'm trying to do something like the following in React JSX (where ObjectRow is a separate component): <tbody> for (var i=0; i < numrows; i++) { <ObjectRow/> } </tbo...

Previous Next