1Open this for a surprise!
2
3https://bit.ly/2JzbP11
4https://attachments.convertkitcdnn2.com/211885/bed3971e-6abb-4e8a-8840-de48cbe847e3/The_React_for_2020_Cheatsheet.pdf
1componentDidMount() {
2 // good for AJAX: fetch, ajax, or subscriptions.
3
4 // invoked once (client-side only).
5 // fires before initial 'render'
6}
1constructor(props) {
2 super(props);
3 this.state = {
4 list: props.initialList
5 };
6}
7
8// where props aren't used in constructor
9
10constructor() {
11 super();
12 this.state = {
13 list: []
14 };
15}