Simple Todo App - Reactxp Typing CST Test
Loading…
Simple Todo App — Reactxp Code
Demonstrates a simple ReactXP app with a Todo list, adding tasks, and displaying them using cross-platform components.
import RX from 'reactxp';
class TodoApp extends RX.Component {
constructor(props) {
super(props);
this.state = { todos: [], newTodo: '' };
}
addTodo = () => {
if (this.state.newTodo.trim()) {
this.setState({ todos: [...this.state.todos, this.state.newTodo], newTodo: '' });
}
};
render() {
return (
<RX.View style={{ padding: 20 }}>
<RX.TextInput
value={this.state.newTodo}
onChangeText={newTodo => this.setState({ newTodo })}
placeholder='New Todo'
style={{ height: 40, borderColor: 'gray', borderWidth: 1, marginBottom: 10 }}
/>
<RX.Button onPress={this.addTodo} style={{ marginBottom: 10 }}>
<RX.Text>Add</RX.Text>
</RX.Button>
{this.state.todos.map((todo, index) => (
<RX.Text key={index}>{todo}</RX.Text>
))}
</RX.View>
);
}
}
RX.App.register('TodoApp', () => TodoApp);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.