React NativeReact Native compiler, IDE, and REPL.

Code, compile, run, and host your programs and apps.

import React from 'react';
import { Button, View } from 'react-native';

const pressCount = 0;

export default class App extends React.Component {
  constructor(props) {
    super(props)

    this.state = {
      pressCount: 0,
    }
  }

  componentDidUpdate() {
    console.log('Press Count: ', this.state.pressCount);
  }

  render() {
    return (
      <View style={{position: 'relative', top: 100}}>
        <Button
          title="Press Me!"
          onPress={() => this.setState({pressCount: this.state.pressCount + 1})}
        />
      </View>
    )
  }
}