1. Home
  2. /
  3. Reactxp
  4. /
  5. Multi Counter

Multi Counter - Reactxp Typing CST Test

Loading…

Multi Counter — Reactxp Code

Multiple independent counters in a single view.

import RX from 'reactxp';

class MultiCounterApp extends RX.Component {
	constructor(props) {
		super(props);
		this.state = { counters: [0,0,0] };
	}

	increment = index => {
		const counters = [...this.state.counters]; counters[index]++; this.setState({ counters });
	};
	decrement = index => {
		const counters = [...this.state.counters]; counters[index]--; this.setState({ counters });
	};

	render() {
		return (
		<RX.View style={{ padding: 20 }}>
		{this.state.counters.map((count, i) => (
		<RX.View key={i} style={{ marginBottom: 10 }}>
		<RX.Text style={{ fontSize: 20 }}>Counter {i+1}: {count}</RX.Text>
		<RX.Button onPress={() => this.increment(i)} style={{ marginRight: 5 }}><RX.Text>+</RX.Text></RX.Button>
		<RX.Button onPress={() => this.decrement(i)}><RX.Text>-</RX.Text></RX.Button>
		</RX.View>
		))}
		</RX.View>
		);
	}
}

RX.App.register('MultiCounterApp', () => MultiCounterApp);

Reactxp Language Guide

ReactXP is a library developed by Microsoft for building cross-platform apps using a single React and React Native codebase. It enables developers to target iOS, Android, and web platforms simultaneously.

Primary Use Cases

  • ▸Cross-platform mobile apps for iOS and Android
  • ▸Web apps sharing the same codebase
  • ▸Rapid prototyping of multi-platform applications
  • ▸Enterprise apps requiring uniform UI across devices
  • ▸Integration with React ecosystem libraries and tooling

Notable Features

  • ▸Cross-platform abstractions for React and React Native
  • ▸Unified event system for gestures and interactions
  • ▸Shared styling system across platforms
  • ▸Supports both JavaScript and TypeScript
  • ▸Optimized for consistency and maintainability

Origin & Creator

Developed by Microsoft in 2016, ReactXP was created to unify mobile and web app development using React while minimizing platform-specific code.

Industrial Note

Perfect for enterprise projects requiring cross-platform consistency and rapid development using React technologies.

More Reactxp Typing Exercises

ReactXP Simple Todo AppReactXP Counter AppReactXP Step CounterReactXP Dark Mode CounterReactXP Auto Increment CounterReactXP Todo With PriorityReactXP Countdown TimerReactXP Counter With Alert

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher