Skip to content

Tag: reactjs

React form onChange->setState one step behind

I encountered this problem building a webapp and I replicated it in this jsfiddle. Essentially, I would like an input to call this.setState({message: input_val}) every time I type something into it, then pass it into the parent App class which then re-renders the message onto the Message class. However the output seems to always be one step behind what I

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 child in an array should have a unique “key” prop. Check the render method of TableComponent. My TableComponent render method returns: The TableHeader

How do I bind react events from a mixin?

I want to write a simple mixin for a tooltip. I already know how to bind my mixin to DOM events: …but I’d like to bind to the React events instead, to take advantage of its consistent event system. How do I do it? Answer I think you probably want to do this in the render method of the mixing

What is the difference between state and props in React?

I was watching a Pluralsight course on React and the instructor stated that props should not be changed. I’m now reading an article (uberVU/react-guide) on props vs. state and it says Both props and state changes trigger a render update. Later in the article it says: Props (short for properties) are a Component’s configuration, its options if you may. They

how to render multiple children without JSX

How to write this without using JSX? This comes from the react.js tutorial: I know I can do the following: But this only adds one element. How can I add more next to one another. AdvertisementAnswer You can use the online Babel REPL ( as a quick way to convert little chunks of JSX […]

react.js: removing a component

I’m fairly new at react.js, so any help is greatly appreciated. I have this: Wherein I have made 2 components: an image and a button. The goal is to remove the image …