Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import PropTypes from 'prop-types';
- import React from 'react';
- import ReactDOM from 'react-dom';
- import snoowrap from 'snoowrap';
- var reddit = new snoowrap({
- userAgent: 'Kevin Hernandez',
- clientId: 'lmGaYiayvosEdQ',
- clientSecret: 'n85F9mz_heHUYwBYGd-2e2VvHN8',
- username: 'jarmahent',
- password: 'Laurh2335'
- });
- class App extends React.Component {
- render() {
- React.createElement(
- button,
- {color: 'blue', shadowSize: 2},
- 'Click Me'
- );
- const divStyle = {
- margin: '40px',
- border: '5px solid pink'
- };
- const marginStyle = {
- margin: '40px',
- border: '5px solid pink'
- };
- return (
- <div style={divStyle}>
- <h1> Hello, {this.props.name} </h1>
- <h3>Array: {this.props.propArray}</h3>
- <h3>Bool: {this.props.propBool ? "True..." : "False..."}</h3>
- <h3>Func: {this.props.getPic()}</h3>
- <h3>Number: {this.props.propNumber}</h3>
- <h3>String: {this.props.propString}</h3>
- <img src=""></img>
- </div>
- );
- }
- }
- App.propTypes = {
- name: PropTypes.string,
- propArray: PropTypes.array.isRequired,
- propBool: PropTypes.bool.isRequired,
- propFunc: PropTypes.func,
- propNumber: PropTypes.number,
- propString: PropTypes.string,
- };
- App.defaultProps = {
- name: 'Tutorialspoint.com',
- propArray: [1, 2, 3, 4, 5],
- propBool: false,
- getPic: function() {
- reddit.getSubreddit('pics').getRandomSubmission().then(function(post){
- return(post.url.toString());
- });
- },
- propNumber: 1,
- propString: "https://i.imgur.com/q4GsltM.jpg"
- }
- export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement