Skip to content

Commit

Permalink
lesson 03: render text only components to reduce dom level
Browse files Browse the repository at this point in the history
  • Loading branch information
wangshijun committed Oct 8, 2017
1 parent 0d4b194 commit a90b9f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/TextOnlyComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React, { Component } from 'react';

const Comment = ({ text }) => text.replace(':)', '[smile]');

class App extends Component {
render() {
return (
<div>
<Comment text="Text only components are awesome :)" />
</div>
);
}
}

export default App;
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './MultiElementRender';
import App from './TextOnlyComponent';
import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(<App />, document.getElementById('root'));
Expand Down

0 comments on commit a90b9f2

Please sign in to comment.