// MyModule.js
var MyModule = {
sayHello: function() {
console.log('Hello, Fbjs!');
}
};
// MyAsyncModule.js
var MyAsyncModule = {
getData: function(callback) {
setTimeout(function() {
var data = { name: 'John', age: 30 };
callback(data);
}, 1000);
}
};
MyAsyncModule.getData(function(data) {
console.log('Received data:', data);
});
// MyComponent.js
var MyComponent = React.createClass({
getInitialState: function() {
return { count: 0 };
},
handleClick: function() {
this.setState({ count: this.state.count + 1 });
},
render: function() {
return (
<div>
<p>Count: {this.state.count}</p>
<button onClick={this.handleClick}>Increase</button>
</div>
);
}
});
ReactDOM.render(<MyComponent />, document.getElementById('root'));