Use spread operator (#95)

* Use spread operator replace Object.assign()

* Fix tag name
main
Peng Jie 7 years ago committed by Michael Fix
parent 1f9c81df9e
commit 3985e35b52

@ -4,14 +4,12 @@ import { COLORS } from '../lib/constants'
export default props => ( export default props => (
<button <button
onClick={props.onClick} onClick={props.onClick}
style={Object.assign( style={{
{ ...props.style,
background: COLORS.BLACK, background: COLORS.BLACK,
color: props.color, color: props.color,
border: `0.5px solid ${props.color}` border: `0.5px solid ${props.color}`
}, }}
props.style
)}
> >
<span>{props.title}</span> <span>{props.title}</span>
<style jsx>{` <style jsx>{`

@ -69,7 +69,7 @@ class Carbon extends React.Component {
} }
render() { render() {
const config = Object.assign(DEFAULT_SETTINGS, this.props.config) const config = { ...DEFAULT_SETTINGS, ...this.props.config }
const options = { const options = {
lineNumbers: false, lineNumbers: false,

@ -7,7 +7,7 @@ export default () => (
<div className="meta"> <div className="meta">
<Head> <Head>
<meta charSet="utf-8" /> <meta charSet="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta <meta
name="description" name="description"

@ -67,7 +67,7 @@ class Editor extends React.Component {
} }
componentDidUpdate() { componentDidUpdate() {
const s = Object.assign({}, this.state) const s = { ...this.state }
delete s.code delete s.code
saveState(localStorage, s) saveState(localStorage, s)
} }

Loading…
Cancel
Save