Skip to content

Instantly share code, notes, and snippets.

View ratelgogo's full-sized avatar
🎯
Focusing

ruofan ratelgogo

🎯
Focusing
  • hangzhou
View GitHub Profile
@ratelgogo
ratelgogo / action.test.js
Last active August 25, 2017 03:15
test examples
import * as actions from './index';
describe("auth actions", () => {
it("should equal login with password request", () => {
expect(actions.LOGIN_WITH_PWD).toEqual({
"REQUEST": "LOGIN_WITH_PWD_REQUEST",
"SUCCESS": "LOGIN_WITH_PWD_SUCCESS",
"FAILURE": "LOGIN_WITH_PWD_FAILURE"
});
});
@ratelgogo
ratelgogo / log.js
Created March 24, 2017 03:26
log react component render with HOC
// in src/log.js
const log = BaseComponent => props => {
console.log(`Rendering ${BaseComponent.name}`);
return <BaseComponent {…props} />;
}
export default log;
// in src/MyComponent.js
import log from ‘./log’;
export default log(MyComponent);