Advertisement
Guest User

Untitled

a guest
Dec 5th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import PropTypes from 'prop-types';
  2. import React from 'react';
  3. import ReactDOM from 'react-dom';
  4. import snoowrap from 'snoowrap';
  5.  
  6. var reddit = new snoowrap({
  7.   userAgent: 'Kevin Hernandez',
  8.   clientId: 'lmGaYiayvosEdQ',
  9.   clientSecret: 'n85F9mz_heHUYwBYGd-2e2VvHN8',
  10.   username: 'jarmahent',
  11.   password: 'Laurh2335'
  12. });
  13.  
  14. class App extends React.Component {
  15.  
  16.  
  17.    render() {
  18.  
  19.      React.createElement(
  20.   button,
  21.   {color: 'blue', shadowSize: 2},
  22.   'Click Me'
  23. );
  24.      const divStyle = {
  25.        margin: '40px',
  26.        border: '5px solid pink'
  27.      };
  28.  
  29.      const marginStyle = {
  30.        margin: '40px',
  31.        border: '5px solid pink'
  32.      };
  33.  
  34.  
  35.  
  36.       return (
  37.          <div style={divStyle}>
  38.             <h1> Hello, {this.props.name} </h1>
  39.             <h3>Array: {this.props.propArray}</h3>
  40.             <h3>Bool: {this.props.propBool ? "True..." : "False..."}</h3>
  41.             <h3>Func: {this.props.getPic()}</h3>
  42.             <h3>Number: {this.props.propNumber}</h3>
  43.             <h3>String: {this.props.propString}</h3>
  44.             <img src=""></img>
  45.  
  46.          </div>
  47.       );
  48.    }
  49. }
  50. App.propTypes = {
  51.    name: PropTypes.string,
  52.    propArray: PropTypes.array.isRequired,
  53.    propBool: PropTypes.bool.isRequired,
  54.    propFunc: PropTypes.func,
  55.    propNumber: PropTypes.number,
  56.    propString: PropTypes.string,
  57. };
  58. App.defaultProps = {
  59.    name: 'Tutorialspoint.com',
  60.    propArray: [1, 2, 3, 4, 5],
  61.    propBool: false,
  62.    getPic: function() {
  63.      reddit.getSubreddit('pics').getRandomSubmission().then(function(post){
  64.        return(post.url.toString());
  65.      });
  66.  
  67.  
  68.    },
  69.    propNumber: 1,
  70.    propString: "https://i.imgur.com/q4GsltM.jpg"
  71. }
  72. export default App;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement