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 => (
<button
onClick={props.onClick}
style={Object.assign(
{
background: COLORS.BLACK,
color: props.color,
border: `0.5px solid ${props.color}`
},
props.style
)}
style={{
...props.style,
background: COLORS.BLACK,
color: props.color,
border: `0.5px solid ${props.color}`
}}
>
<span>{props.title}</span>
<style jsx>{`

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

@ -7,7 +7,7 @@ export default () => (
<div className="meta">
<Head>
<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="description"

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

Loading…
Cancel
Save