This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let state = { | |
lists: [1, 2, 3, 4], | |
items: ['a', 'b', 'c'], | |
} | |
const cloneMyState = (f) => { | |
let copy = { | |
items: [...state.items], | |
lists: [...state.lists] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Use React Context + Provider/Consumer - Works with both Functional and Class Components | |
import React from 'react'; | |
const Context = React.createContext(); | |
const ContextApp = () => { | |
return ( | |
<Context.Provider value={['THE', 'QUICK', 'BROWN', 'FOX', 'JUMPS', 'OVER', 'THE', 'LAZY', 'DOG']}> | |
<CustomComponent/> | |
</Context.Provider> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:convert'; | |
import 'dart:async' show Future; | |
import 'package:flutter/services.dart' show rootBundle; | |
class Student { | |
String studentId; | |
String studentName; | |
int studentScores; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:convert'; | |
import 'dart:async' show Future; | |
import 'package:flutter/services.dart' show rootBundle; | |
class Student { | |
String studentId; | |
String studentName; | |
int studentScores; | |
Student({this.studentId, this.studentName, this.studentScores}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'dart:convert'; | |
import 'dart:async' show Future; | |
import 'package:flutter/services.dart' show rootBundle; | |
class Student { | |
String studentId; | |
String studentName; | |
int studentScores; | |
Student({this.studentId, this.studentName, this.studentScores}); |