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-10-10 02:23:06