Last active
March 23, 2019 22:49
-
-
Save rapPayne/3119c0757583f4124a5c064f24f39cd1 to your computer and use it in GitHub Desktop.
React Native vs Flutter - React Native statefull component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; // <-- 1 | |
| import { Button, Image, SafeAreaView, ScrollView, Text, View } from 'react-native'; | |
| import { store } from './store/store'; // <-- 2 | |
| import { DatePicker } from './DatePicker'; // <-- 3 | |
| import { FilmBrief } from './FilmBrief'; // <-- 3 | |
| import { FilmDetails } from './FilmDetails'; // <-- 3 | |
| import { ShowingTimes } from './ShowingTimes'; // <-- 3 | |
| export class Landing extends Component { // <-- 4 | |
| constructor(props) { // <-- 5 | |
| super(props); | |
| this.state = {...store.getState()}; // <-- 6 | |
| store.subscribe(() => this.setState(store.getState())); // <-- 6 | |
| } | |
| componentDidMount() { // <-- 7 | |
| store.dispatch({type: "FETCH_FILMS"}); | |
| } | |
| render() { | |
| // This is where the subcomponents will be drawn. // <-- 8 | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment