I'm using ReactJS (by facebook) and I have the option of calling setState or setProps, but don't know which is more efficient performance-wise.

(Don't take my code on face value. This is just a simplification. My main concern is knowing which of setProps or setState is faster.)

For setProps I have:

function XHRcallback(data) {
  React.renderComponent(MainApp, $("container")).setProps(data);

For setState I have:

var updateAll;

function XHRcallback(data) {

var List = React.createClass({
  getInitialState: function() {

    updateAll = function(data) {


  render: function() {
Was it helpful?


State and props are equally efficient in React; they're used for different things. Think of props as inputs to your component, and state as internal, private variables.

See Thinking in React for a discussion of state vs. props.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top