React Component Lifecycle
- getInitialState
- getDefaultProps
- componentWillMount
- componentDidMount
- shouldComponentUpdate (Update only)
- componentWillUpdate (Update only)
- componentWillReceiveProps (Update only)
- render
| import React from "react"; | |
| import PropTypes from "prop-types"; | |
| class Image extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { src: props.src }; | |
| } | |
| componentWillReceiveProps(nextProps) { |
React Component Lifecycle
| import * as web3 from "@solana/web3.js"; | |
| import * as metadata from "./metadata"; // see metadata.ts | |
| const tokenAddress = new web3.PublicKey( | |
| "CxkKDaBvtHqg8aHBVY8E4YYBsCfJkJVsTAEdTo5k4SEw" | |
| ); | |
| (async () => { | |
| // Connect to cluster | |
| var connection = new web3.Connection( |
| const web3 = require('@solana/web3.js'); | |
| const splToken = require('@solana/spl-token'); | |
| (async () => { | |
| //create connection to devnet | |
| const connection = new web3.Connection(web3.clusterApiUrl("devnet")); | |
| //generate keypair and airdrop 1000000000 Lamports (1 SOL) | |
| const myKeypair = web3.Keypair.generate(); |
| import { | |
| Account, | |
| clusterApiUrl, | |
| Connection, | |
| PublicKey, | |
| sendAndConfirmTransaction, | |
| SystemProgram, | |
| Transaction, | |
| } from '@solana/web3.js'; |
| import React, { useState } from "react"; | |
| import { SafeAreaView, Text } from "react-native"; | |
| import { | |
| Gesture, | |
| GestureDetector, | |
| GestureHandlerRootView, | |
| } from "react-native-gesture-handler"; | |
| export default function GestureDemo() { | |
| const [tGestureStart, setTGestureStart] = useState<undefined | string>(); |
Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)
Here are the tools we’ll be using to create the bot —
I got to here after spending hours trying to deploy to an Elastic Beanstalk instance via CircleCi 2.0 so I thought I'd write up what worked for me to hopefully help others. Shout out to RobertoSchneiders who's steps for getting it to work with CircleCi 1.0 were my starting point.
For the record, I'm not the most server-savvy of developers so there may be a better way of doing this.
| import * as Sentry from '@sentry/browser'; | |
| import getConfig from 'next/config'; | |
| import React from 'react'; | |
| const { SENTRY_DSN } = getConfig().publicRuntimeConfig; | |
| Sentry.init({ dsn: SENTRY_DSN }); | |
| /** | |
| * Send an error event to Sentry. |
| var accounts = [ | |
| { name: 'James Brown', msgCount: 123 }, | |
| { name: 'Stevie Wonder', msgCount: 22 }, | |
| { name: 'Sly Stone', msgCount: 16 }, | |
| { name: 'Otis Redding', msgCount: 300 } // Otis has the most messages | |
| ]; | |
| // get sum of msgCount prop across all objects in array | |
| var msgTotal = accounts.reduce(function(prev, cur) { | |
| return prev + cur.msgCount; |