Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Counter app with light/dark theme toggle.
import RX from 'reactxp';
class DarkModeCounterApp extends RX.Component {
constructor(props) {
super(props);
this.state = { count: 0, isDark: false };
}
increment = () => this.setState({ count: this.state.count + 1 });
decrement = () => this.setState({ count: this.state.count - 1 });
reset = () => this.setState({ count: 0 });
toggleTheme = () => this.setState({ isDark: !this.state.isDark });
render() {
return (
<RX.View style={{ padding: 20, backgroundColor: this.state.isDark ? '#333' : '#fff', flex: 1 }}>
<RX.Text style={{ fontSize: 24, marginBottom: 10, color: this.state.isDark ? '#fff' : '#000' }}>Counter: {this.state.count}</RX.Text>
<RX.Button onPress={this.increment} style={{ marginRight: 10 }}><RX.Text>+</RX.Text></RX.Button>
<RX.Button onPress={this.decrement} style={{ marginRight: 10 }}><RX.Text>-</RX.Text></RX.Button>
<RX.Button onPress={this.reset} style={{ marginRight: 10 }}><RX.Text>Reset</RX.Text></RX.Button>
<RX.Button onPress={this.toggleTheme}><RX.Text>Toggle Theme</RX.Text></RX.Button>
</RX.View>
);
}
}
RX.App.register('DarkModeCounterApp', () => DarkModeCounterApp);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.
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.