refluxjs

How to test Reflux actions with Jest

﹥>﹥吖頭↗ 提交于 2019-11-29 10:23:29
问题 I'm having difficulty testing that Reflux actions are triggering correctly in my application, and in fact they do not seem to be working at all with Jest. I have this example test: jest.autoMockOff(); describe('Test', function () { it('Tests actions', function () { var Reflux = require('../node_modules/reflux/index'); var action = Reflux.createAction('action'); var mockFn = jest.genMockFn(); var store = Reflux.createStore({ init: function () { this.listenTo(action, this.onAction); }, onAction

How does react-router pass params to other components via props?

人走茶凉 提交于 2019-11-28 18:39:37
Thus far, the extent of my knowledge about how properties are passed from one component to another via parameters is as follows //start: extent of my knowledge Suppose there exists some state variable called topic in A.jsx. I want to pass this down to B.jsx, so I perform the following B = require('./B.jsx') getInitialState: function() {return {topic: "Weather"}} <B params = {this.state.topic}> In B.jsx I can then do stuff like module.exports = React.createClass({ render: function() { return <div><h2>Today's topic is {this.props.params}!</h2></div> } }) which when called upon will render "Today

How does react-router pass params to other components via props?

痞子三分冷 提交于 2019-11-27 11:09:14
问题 Thus far, the extent of my knowledge about how properties are passed from one component to another via parameters is as follows //start: extent of my knowledge Suppose there exists some state variable called topic in A.jsx. I want to pass this down to B.jsx, so I perform the following B = require('./B.jsx') getInitialState: function() {return {topic: "Weather"}} <B params = {this.state.topic}> In B.jsx I can then do stuff like module.exports = React.createClass({ render: function() { return