Skip to content

Instantly share code, notes, and snippets.

@Ivsath
Ivsath / ClassCtor.jsx
Last active October 22, 2020 02:12
ClassesReact
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {
count: 0
};
@Ivsath
Ivsath / ControlledForm.jsx
Last active October 25, 2020 04:40
HooksReact
import React from 'react'
function UsernameForm({onSubmitUsername}) {
const [username, setUsername] = React.useState('')
function handleSubmit(event) {
event.preventDefault()
onSubmitUsername(username)
}