-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.js
175 lines (161 loc) · 4.89 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import FilterableProductTable from './ProductDetails';
import Calculator from './TemperatureCalculator';
import {MousePointerTracker, AnotherMousePointerTracker } from './renderPropsEx/MousePointerTracker';
import ComponentNeedingStorage from './anotherRenderPropsEx/ComponentNeedingStorage';
import FileInput from './uncontrolled-components/FileInput';
import NameForm from './uncontrolled-components/NameForm';
import Username from './functional-components/Username';
import { BlueButton, ButtonWithEvent } from './functional-components/Button';
import TypingHistory from './pure-component/typing-history';
import registerServiceWorker from './registerServiceWorker';
import { CounterComponent, Counter } from './thirdRenderPropsEx/Counter';
import CounterExample from './higher-order-components/CounterHoC';
import AppSuperCompose from './context/AppSuperComposed';
import ThemeAppWithoutContext from './context/react-sample-1/ThemeApp';
import ThemedAppWithContext from './context/react-sample-using-context/ThemedAppWithContext';
import ThemedAppWDContext from './context/dynamic-context-ex/ThemedAppWDynamicContext';
import UpdatingContextApp from './context/updating-context-ex/UpdatingContextApp';
import MultipleContextParentApp from './context/multiple-contexts/MultipleContextParentApp';
import ContextWHOCApp from './context/context-with-hoc/ContextWHOCApp';
import ParentComponent from './portals/ParentComponent';
import TooltipApp from "./portals/portals-tooltip-ex/TooltipApp";
const PRODUCTS = [
{category: 'Sporting Goods', price: '$49.99', stocked: true, name: 'Football'},
{category: 'Sporting Goods', price: '$9.99', stocked: true, name: 'Baseball'},
{category: 'Sporting Goods', price: '$29.99', stocked: false, name: 'Basketball'},
{category: 'Electronics', price: '$99.99', stocked: true, name: 'iPod Touch'},
{category: 'Electronics', price: '$399.99', stocked: false, name: 'iPhone 5'},
{category: 'Electronics', price: '$199.99', stocked: true, name: 'Nexus 7'}
];
ReactDOM.render(
<TooltipApp />,
document.getElementById('root')
);
registerServiceWorker();
/*
ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();
*/
/* Searchable Product Details Filter - Thinking in React
ReactDOM.render(
<FilterableProductTable
products={PRODUCTS}
/>, document.getElementById('root')
);
*/
/* Temperature Calculator - Lifting Up State
ReactDOM.render(
<Calculator />,
document.getElementById('root')
)
*/
/* Render Props - Mouse Pointer Tracker and Storage examples
ReactDOM.render(
<React.Fragment>
<MousePointerTracker />
<AnotherMousePointerTracker />
<ComponentNeedingStorage />
</React.Fragment>,
document.getElementById('root')
);
*/
/* Uncontrolled Components example
ReactDOM.render(
<React.Fragment>
<NameForm />
<br/>
<FileInput />
</React.Fragment>,
document.getElementById('root')
);
*/
/* Functional Component example
ReactDOM.render(
<React.Fragment>
<Username username='Zain Pathan' />
<BlueButton onClick={() => {
alert('Blue Button clicked');
}}/>
<br/>
<br/>
<ButtonWithEvent name='Zain Pathan'/>
</React.Fragment>,
document.getElementById('root')
);
*/
/*
ReactDOM.render(
<TypingHistory />,
document.getElementById('root')
);
*/
/* Render Props Example
ReactDOM.render(
//<ComponentNeedingStorage />
<React.Fragment>
<MousePointerTracker />
<AnotherMousePointerTracker />
<br/>
<CounterComponent
render={
props => {
return ( <Counter {...props} /> )
}
}
/>
</React.Fragment>,
document.getElementById('root')
);
*/
/* Higher Order Components Example
ReactDOM.render(
<CounterExample />,
document.getElementById('root')
);
*/
/* Context Example - multiple
ReactDOM.render(
<React.Fragment>
<AppSuperCompose />
<br/>
<ThemeAppWithoutContext />
<br/>
<h2>Themed App With Context</h2>
<br/>
<ThemedAppWithContext />
<br/>
<hr/>
<h2>Themed App with Dynamic Context</h2>
<br/>
<ThemedAppWDContext />
<br/>
<hr/>
<h2>Updating Context</h2>
<br/>
<UpdatingContextApp />
<br/>
<hr/>
<h2>Multiple Context being used in a single component</h2>
<br/>
<MultipleContextParentApp />
<br/>
<hr/>
<h2>Context used with HOC</h2>
<br/>
<ContextWHOCApp />
<br/>
<hr/>
</React.Fragment>,
document.getElementById('root')
);
*/
/* Portal simple modal example
ReactDOM.render(
<ParentComponent />,
document.getElementById('app-root')
);
*/