EnterBudget component example

Building and linking this component involved changing the App.js file. Let's take a look at that one first since it passes props down to the EnterBudget component:

// Expenses/app/App.js... import EnterBudget from './components/EnterBudget';  export default class App extends Component {   ...

Set the month and year in state, then call _updateBudget:

  componentWillMount () {     this.setState({       month: dateMethods.getMonth(),       year: dateMethods.getYear()     });      this._updateBudget();   }

Push EnterBudget to the navigator and pass it two props. Hide the navigation bar so that the user cannot leave without entering a budget for the month:

  ...   _renderEnterBudgetComponent () {     this.props.navigator.push({  component: ...

Get React Native By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.