Skip to content

Commit 69a8cc2

Browse files
author
Jonathon Kelly
committed
convert to a stateless component and update packages
1 parent a402de5 commit 69a8cc2

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

.eslintrc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"rules": {
55
"indent": [2, 4, {"SwitchCase": 1}],
66
"max-len": [2, 140, 2],
7-
8-
"react/jsx-indent-props": [2, 4],
9-
"react/prefer-stateless-function": 0
7+
"react/jsx-indent-props": [2, 4]
108
}
119
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
"dist"
88
],
99
"scripts": {
10+
"clean": "rimraf dist",
1011
"start": "webpack-dev-server",
11-
"clean-build": "rimraf dist",
12-
"build": "npm run clean-build && babel src --out-dir dist",
12+
"build": "npm run clean && babel src --out-dir dist",
1313
"build-pages": "npm run clean-build && NODE_ENV=production webpack --config ./webpack.production.config.js --progress --profile --colors",
1414
"lint": "eslint --ignore-path .gitignore .",
1515
"test": "npm run lint",
1616
"prepublish": "npm run build && npm test",
17-
"prepublish-pages": "npm run build-pages",
17+
"prepublish-pages": "npm run build-pages && npm test",
1818
"publish-pages": "gh-pages -d dist"
1919
},
2020
"repository": {
@@ -41,7 +41,7 @@
4141
"babel-preset-react": "^6.5.0",
4242
"copy-webpack-plugin": "^1.1.1",
4343
"css-loader": "^0.23.1",
44-
"eslint": "^2.5.3",
44+
"eslint": "^2.6.0",
4545
"eslint-config-airbnb": "^6.2.0",
4646
"eslint-plugin-react": "^4.2.3",
4747
"gh-pages": "^0.11.0",

pages/main.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class App extends React.Component {
2727
<div>
2828
<h2>Markdown Editor</h2>
2929

30-
<Textarea value={this.state.markdown} onChange={this.onChange} />
30+
<Textarea value={this.state.markdown} onChange={this.updateMarkdown} />
3131
</div>
3232

3333
<div>

src/index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import React from 'react';
22
import marked from 'marked';
33

4-
class MarkdownRenderer extends React.Component {
5-
render() {
6-
const html = marked(this.props.markdown || '', { sanitize: true });
4+
function MarkdownRenderer(props) {
5+
const html = marked(props.markdown || '', { sanitize: true });
76

8-
return (
9-
<div className={this.props.className} dangerouslySetInnerHTML={{ __html: html }}></div>
10-
);
11-
}
7+
return (
8+
<div className={props.className} dangerouslySetInnerHTML={{ __html: html }}></div>
9+
);
1210
}
1311

1412
MarkdownRenderer.propTypes = {

0 commit comments

Comments
 (0)