All Questions

125
votes
8answers
41224 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...
43
votes
4answers
2531 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 ...
473
votes
21answers
261872 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 ...
183
votes
19answers
84236 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 ...
96
votes
4answers
36881 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...
5
votes
2answers
1132 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...
298
votes
5answers
59829 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...
498
votes
33answers
338950 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...
5
votes
2answers
834 views

Programatically 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...
165
votes
2answers
135872 views

Understanding unique keys for array children in React.js

I'm building a React component that accepts a JSON data source and creates a sortable table. Each of the dynamic data rows has a unique key assigned to it but I'm still getting an error of: Each ...

Previous Next