Cannot assign to read only property 'props' of #<Object> in react native

If this is happening to you not because of props but because of state, you may be trying to do an assignment like this:

this.state.nav = 'whatever';

Remember that assignments to state in React should be like:

this.setState({
  nav: 'whatever'
});

You cannot push to props this.props.nav.push({id: 'Applist', index: 2}); since component properties are read-only, as the error states. Props can only be derived from a parent component, but cannot be modified.

EDIT: This article is a great starting point for people confused in this matter as I was a while ago:) https://reactjs.org/docs/thinking-in-react.html


You write this.props.nav.push({id: 'Applist', index: 2});

But this.props is read-only; you cannot modify it.

If you want to pass some value to the parent react component, then you can use this.prop.onSomeEvent(value) in a child component. Then handle the push process in the parent component.