1. Home
  2. /
  3. React-native
  4. /
  5. React Native Simple Todo App

React Native Simple Todo App - React-native Typing CST Test

Loading…

React Native Simple Todo App — React-native Code

Demonstrates a simple React Native app with a list of todos, adding and removing tasks, and state management using useState.

import React, { useState } from 'react';
import { View, Text, TextInput, Button, FlatList } from 'react-native';

export default function App() {
  const [todos, setTodos] = useState([]);
  const [text, setText] = useState('');

  const addTodo = () => {
    setTodos([...todos, { key: String(todos.length), title: text }]);
    setText('');
  };

  return (
    <View style={{ padding: 20 }}>
      <TextInput value={text} onChangeText={setText} placeholder='New Todo' />
      <Button title='Add' onPress={addTodo} />
      <FlatList data={todos} renderItem={({ item }) => <Text>{item.title}</Text>} />
    </View>
  );
}

React-native Language Guide

React Native is a popular open-source framework for building cross-platform mobile applications using JavaScript and React, allowing developers to write a single codebase for iOS and Android while delivering near-native performance.

Primary Use Cases

  • ▸Cross-platform mobile applications for iOS and Android
  • ▸Consumer-facing apps with rich UI and interactions
  • ▸Enterprise mobile solutions and dashboards
  • ▸Prototyping and MVP development
  • ▸Apps requiring some native module integration

Notable Features

  • ▸Write once, run on both iOS and Android
  • ▸Declarative UI with React components
  • ▸Hot reload and fast refresh for quick iteration
  • ▸Access to native modules and APIs
  • ▸Large ecosystem of libraries and community support

Origin & Creator

Created by Facebook in 2015 and maintained by Meta and the React Native community.

Industrial Note

React Native is widely used for cross-platform mobile apps in startups and enterprises, enabling rapid development with a single codebase while achieving near-native performance.

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher