Skip to content
Snippets Groups Projects
Commit add6619a authored by Cliff Li's avatar Cliff Li
Browse files

Refactor for default props (and fix spread operator)

parent 18452c32
No related branches found
No related tags found
1 merge request!32Polythene components
{
"plugins": ["transform-object-rest-spread"]
}
\ No newline at end of file
......@@ -33,5 +33,8 @@
"uglifyjs-webpack-plugin": "^1.0.1",
"webpack": "^3.8.1",
"webpack-dev-server": "^2.9.3"
},
"devDependencies": {
"babel-plugin-transform-object-rest-spread": "^6.26.0"
}
}
import m from "mithril";
import { Button } from "polythene-mithril";
import "polythene-css"
import "polythene-css";
const ButtonComponent = () => {
return Button;
const defaultProps = {
element: 'button',
}
const ButtonComponent = props => {
return m(Button, {...defaultProps, ...props});
}
export default ButtonComponent;
\ No newline at end of file
......@@ -38,7 +38,7 @@ export default class studydocList {
},
}, [
m('input', { type: 'text', oninput: m.withAttr('value', (value) => { this.search = value; }) }, ''),
m(Button, { label: 'Search', type: 'submit' }),
Button({ label: 'Search' }),
]),
m('button', { onclick: () => m.route.set('/studydocuments/new') }, 'add new'),
m('table', [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment