Created
July 4, 2018 12:36
-
-
Save asiniy/23b3df32b190fe57dabdb354d7d07a33 to your computer and use it in GitHub Desktop.
MyComponentFinal.jsx // Extending JavaScript with ease (beginner level tutorial)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import objectFetch from 'object-fetch' | |
INNER_CIRCLE_TARGETS_COUNT = 10 | |
class MyComponent extends React.Component { | |
render() { | |
// A big function with a complex logic | |
const { collectorGroup } = this.props | |
// Line below will throw an error if there is no `targets_count` property in the dom. | |
const collectorGroupHasFewCircles = (objectFetch(collectorGroup, 'targets_count') > INNER_CIRCLE_TARGETS_COUNT) | |
// return big render here | |
} | |
} | |
export default MyComponent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment