1. Home
  2. /
  3. Nativebase
  4. /
  5. Counter App

Counter App - Nativebase Typing CST Test

Loading…

Counter App — Nativebase Code

Simple counter with increment, decrement, and reset buttons using NativeBase components.

import React, { useState } from 'react';
import { NativeBaseProvider, Box, Button, VStack, Text } from 'native-base';

export default function App() {
	const [count, setCount] = useState(0);

	return (
		<NativeBaseProvider>
		<Box safeArea p={4}>
		<VStack space={4} alignItems="center">
		<Text fontSize="2xl">Counter: {count}</Text>
		<Button onPress={() => setCount(count + 1)}>+</Button>
		<Button onPress={() => setCount(count - 1)}>-</Button>
		<Button onPress={() => setCount(0)}>Reset</Button>
		</VStack>
		</Box>
		</NativeBaseProvider>
	);
}

Nativebase Language Guide

NativeBase is an open-source UI component library for React Native, providing a set of cross-platform, customizable components that accelerate mobile app development with consistent design.

Primary Use Cases

  • ▸Cross-platform mobile app development
  • ▸Rapid UI prototyping
  • ▸Enterprise React Native apps
  • ▸Apps requiring consistent theming across devices
  • ▸Integration with Expo and React Native ecosystem

Notable Features

  • ▸Pre-built, customizable components
  • ▸Cross-platform support (iOS and Android)
  • ▸Themeable design system
  • ▸Flexbox-based responsive layouts
  • ▸Integration with Expo and third-party libraries

Origin & Creator

Developed by GeekyAnts, first released in 2016 to simplify React Native UI development and provide a consistent cross-platform component library.

Industrial Note

NativeBase is widely used for startups, enterprise mobile apps, and cross-platform React Native projects that need rapid prototyping and production-ready UI components.

More Nativebase Typing Exercises

NativeBase Simple Todo AppNativeBase Dark Mode CounterNativeBase Step CounterNativeBase Multi CounterNativeBase Auto Increment CounterNativeBase Todo With PriorityNativeBase Countdown TimerNativeBase Counter With Alert

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher