Skip to content

Instantly share code, notes, and snippets.

@bpas247
bpas247 / state-updates-are-async.md
Last active March 17, 2023 17:12
State Updates Are Asynchronous

State Updates Are Asynchronous

The gist of it

You do this.

const handleEvent = e => {
  setState(e.target.value);
  console.log(state);
}
@bpas247
bpas247 / App.js
Last active December 12, 2019 19:19 — forked from hutchcrowley/App.js
Attempting to retrieve user data from the GitHub API and render the data using React class component lifecycle methods. Help!
import React from 'react'
import './App.css'
import axios from 'axios'
import UserCard from './Components/UserCard'
// import FollowersList from './Components/FollowersList'
class App extends React.Component {
constructor(props) {
@bpas247
bpas247 / tests.js
Last active January 23, 2020 20:59
import { runSpecs } from "spec_helper";
import chai from "chai";
import { user, image_paths } from "fake_data";
import { mount } from "enzyme";
import Component from "components/Exercises/List";
const list = [];
const settings = {
suggestions: []
@bpas247
bpas247 / Parent.js
Last active January 27, 2020 21:00 — forked from seanconnelly34/Child.js
import React, { Component } from "react";
import axios from "axios";
import Button from "../Button";
import { Checkbox } from "antd";
class Models extends Component {
state = {
models: [],
selected: {}
};
@bpas247
bpas247 / album.js
Last active January 28, 2020 00:11 — forked from DDavis1025/album.js
import React, { Component } from "react";
import AlbumFields from "./albumFields";
import { ButtonToggle } from "reactstrap";
class Album extends Component {
state = {
albums: []
};
componentDidMount() {
@bpas247
bpas247 / App.js
Last active September 12, 2020 19:58 — forked from jwalt39/App.js
import React, { Component } from "react";
import { render } from "react-dom";
import {
BrowserRouter as Router,
Switch,
Route,
Link,
Redirect,
} from "react-router-dom";
import { AuthenticatedRoute, Login } from "./Authentication";
@bpas247
bpas247 / App.js
Last active September 12, 2020 20:35 — forked from jwalt39/App.js
import React, { Component } from "react";
import { render } from "react-dom";
import {
BrowserRouter as Router,
Switch,
Route,
Link,
Redirect,
withRouter,
} from "react-router-dom";
import React from 'react'
import { Button, Card, Container, Dropdown, FormControl } from 'react-bootstrap'
import './App.css'
import 'bootstrap/dist/css/bootstrap.css'
const titleApp = `Convertly.io`
const desc = `${titleApp} a React application using exchangeratesapi.io API to convert currencies`
export class Conversion extends React.Component {
constructor(props) {