Skip to content

Instantly share code, notes, and snippets.

@awinogradov
Last active August 17, 2016 08:12
Show Gist options
  • Save awinogradov/40e2d678b6564070b64434eec0d96acd to your computer and use it in GitHub Desktop.
Save awinogradov/40e2d678b6564070b64434eec0d96acd to your computer and use it in GitHub Desktop.
react-flex
const block = require('react-flex/block');
module.exports = block('button')(
tag() => 'button',
attrs() => ({
name: this.ctx.name,
id: this.ctx.id
}),
onClick(e) => {
console.log('shit!');
},
onComponentDidMount() => {
console.log('component was mounted');
}),
content() => ({
elem: 'text',
content: this.ctx.text
})
);
const block = require('../button.react.js');
module.exports = block('button').elem('text')(
tag() => 'span',
onHover(e) => {
console.log('text hovered!');
},
onComponentDidMount() => {
console.log('elem text was mounted');
},
content() => `${this.applyNext()} and extend`
);
const block = require('../button.react.js');
module.exports = block('button').mod('theme', 'wow')(
onClick(e) => {
console.log('component with theme!');
return this.applyNext();
}
);
const Button = require('./button.react.js');
const React = require('./react');
React.render(<Button theme='wow' text='button text' />);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment