Renaming SVG to Render

This commit is contained in:
Jeff Avallone 2019-01-12 12:32:00 -05:00
parent 1336862bce
commit 8187865f1f
3 changed files with 8 additions and 5 deletions

View File

@ -4,13 +4,12 @@ import { AppContextProvider } from 'components/AppContext';
import Form from 'components/Form'; import Form from 'components/Form';
import Loader from 'components/Loader'; import Loader from 'components/Loader';
import Message from 'components/Message'; import Message from 'components/Message';
import SVG from 'components/SVG'; import Render from 'components/Render';
class App extends React.PureComponent { class App extends React.PureComponent {
state={} state={}
handleRender = ({ syntax, expr }) => { handleRender = ({ syntax, expr }) => {
console.log('Render:', syntax, expr); // eslint-disable-line no-console
this.setState({ syntax, expr }); this.setState({ syntax, expr });
} }
@ -30,7 +29,7 @@ class App extends React.PureComponent {
<a href="#retry" onClick={ this.handleRetry }>Retry</a> <a href="#retry" onClick={ this.handleRetry }>Retry</a>
</Message> </Message>
<SVG /> <Render />
</AppContextProvider>; </AppContextProvider>;
} }
} }

View File

@ -6,7 +6,7 @@ import style from './style.module.css';
import AppContext from 'components/AppContext'; import AppContext from 'components/AppContext';
class SVG extends React.PureComponent { class Render extends React.PureComponent {
static contextType = AppContext static contextType = AppContext
svgContainer = React.createRef() svgContainer = React.createRef()
@ -33,6 +33,10 @@ class SVG extends React.PureComponent {
} }
render() { render() {
const { syntax, expr } = this.context;
console.log('Render:', syntax, expr); // eslint-disable-line no-console
// Demo rendering for now // Demo rendering for now
return <div className={ style.render } ref={ this.svgContainer }> return <div className={ style.render } ref={ this.svgContainer }>
<PlaceholderIcon /> <PlaceholderIcon />
@ -40,4 +44,4 @@ class SVG extends React.PureComponent {
} }
} }
export default SVG; export default Render;