Flux has four major components: Stores, Dispatchers, Views, and Actions. These components interact less like a typical MVC and more like an Event Bus.
src/js/dispatchers/app-dispatcher.js
var Dispatcher = require(‘flux‘).Dispatcher, assign = require(‘react/lib/Object.assign‘); var AppDispatcher = assign(new Dispatcher(), { handleViewAction: function (action) { this.dispatch({ source: ‘VIEW_ACTION‘, action: action }); } }); module.exports = AppDispatcher;
时间: 2024-12-09 13:10:52