Accessing class variable declared in constructor in other parts of the app (React)
问题 I'm currently learning React-native. I am following a Pluralsight tutorial but unfortunately some of his code is out of date. I have the following code: import Expo from 'expo'; import React from 'react'; import TaskList from './TaskList'; import { Component, View, Navigator, Text } from 'react-native'; class todo extends React.Component { constructor(props,context){ super(props,context); this.state ={ todos: [ { task: 'Task1', }, { task: 'Task 2', }, ] } } onAddStarted(){ this.nav.push({