Skip to content

Commit de6e44a

Browse files
committed
updating notes on react.js line breaks from CRLF to LF
1 parent db25aeb commit de6e44a

12 files changed

+210
-124
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
/**
22
* ACCESSING DOM IN REACTJS
33
* - check out /dom/dom.js example
4-
* - This allows you to refer and access any element that you have in your reactjs component by using
4+
* - This allows you to refer and access any element that you have in your reactjs component by using
55
* getDOMNode and ref'ing to it.
6-
*
6+
*
77
* - getDOMNode
8-
* - is a function we can call to get reference to components DOMNode.
9-
* - This only works on mounted components. Components that has been placed in the DOM.
10-
* - If you try to call this on a component that has not been mounted yet like calling
11-
* getDOMNode in render function on a component that has yet to be created in this
8+
* - is a function we can call to get reference to components DOMNode.
9+
* - This only works on mounted components. Components that has been placed in the DOM.
10+
* - If you try to call this on a component that has not been mounted yet like calling
11+
* getDOMNode in render function on a component that has yet to be created in this
1212
* case an exception error will be thrown.
1313
* - refs
1414
* - refers to a react component you own
15-
*/
15+
*/

1.0-reactjsNotes/reactjsBabelNotes.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
/**
22
* JSX Babel COMPILER IN REACTJS
3-
* - As announced, starting with React v0.14 (next release), the JSXTransformer.js won't be
4-
* part of the release. Also `react-tools` npm package is no more. So whatchagonnawannado
3+
* - As announced, starting with React v0.14 (next release), the JSXTransformer.js won't be
4+
* part of the release. Also `react-tools` npm package is no more. So whatchagonnawannado
55
* is switch to Babel. Here's how.
6-
*
6+
*
77
* Build-time transform
88
* - Prerequisite: install Babel
99
* - $ npm install --global babel
10-
*
10+
*
1111
* Where you previously had this as part of your development/build process:
1212
* - $ jsx --watch source/ build/
1313
* ...now becomes
1414
* - $ babel source/ --watch --out-dir build/
15-
*
15+
*
1616
* In-browser transform
17-
* - Required warning: in-browser transforms are just for testing and playing and prototyping.
17+
* - Required warning: in-browser transforms are just for testing and playing and prototyping.
1818
* Never for live sites.
19-
*
19+
*
2020
* Now with that out of the way, let's see how to switch to Babel.
2121
* Prerequisite: a file called browser.js. You'll find in in your node_modules, e.g.
2222
* - $ ls /usr/local/lib/node_modules/babel/node_modules/babel-core/browser.js
23-
*
23+
*
2424
* Slightly easier to find if you npm install babel-core:
25-
* - $ ls /usr/local/lib/node_modules/babel-core/browser.js
26-
*
25+
* - $ ls /usr/local/lib/node_modules/babel-core/browser.js
26+
*
2727
* Anyway, find browser.js and put it somewhere handy. Now where you used to have:
28-
*
28+
*
2929
* <script src="react/build/react.js"></script>
3030
* <script src="react/build/JSXTransformer.js"></script>
3131
*... now you do:
3232
* <script src="react/build/react.js"></script>
3333
* <script src="babel/browser.js"></script>
34-
*
35-
* Finally, instead of the invalid type="text/jsx" you used to add to your script tags, now
34+
*
35+
* Finally, instead of the invalid type="text/jsx" you used to add to your script tags, now
3636
* you do type="text/babel", like:
3737
* <script type="text/babel">
3838
* React.render(
@@ -42,4 +42,4 @@
4242
* document.getElementById('app')
4343
* );
4444
* </script>
45-
*/
45+
*/

1.0-reactjsNotes/reactjsComponentNotes.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,65 @@
33
* - components are classes in react js
44
* - All components should start with a capital letter
55
* - Components are functions
6-
*
6+
*
77
* Life Cycle State and Methods
8-
* - We have 3 states: Mount, Update, Unmount
8+
* - We have 3 states: Mount, Update, Unmount
99
* - Each state has their own methods
1010
* - Mount State
1111
* - componentWillMount Method
1212
* - is invoked once both on the client and on the server
13-
* - immediately before the inital render occurs, if you call setState() within this method, render will
13+
* - immediately before the inital render occurs, if you call setState() within this method, render will
1414
* see this updated state and will be excuted only once despite the state change
1515
* - componentDidMount Method
1616
* - is invoked once only on the client, not on the server
1717
* - immediately after the inital render occurs, at this point in the life cycle the component has DOM
1818
* representation which you can access via React.findDOMNode(component)
1919
* - if you want to integrate with other js frameworks, set timers using setTimeout() or setInterval() or
20-
* send ajax requests, you can perform those operations in this method. Soon as component is mounted, we can do
20+
* send ajax requests, you can perform those operations in this method. Soon as component is mounted, we can do
2121
* our stuff inside that method.
2222
* - Update State
2323
* - componentWillReceiveProps Method
24-
* - is invoked when a component is receiving new properties.
24+
* - is invoked when a component is receiving new properties.
2525
* - this method is not called for the inital render. We can use this as an opportunity to react to a property
2626
* transition before render is called by updating the state using this.setState(). The old properties can be
2727
* accessed via this.props calling this.setState() within this function will not a trigger an additional render
2828
* - shouldComponentUpdate Method
2929
* - is invoked before rendering when new properties or state are being received. This method is not called for the
30-
* inital render or than a forced update is used. We can use this as an opportunity to reinforce when you are certain
30+
* inital render or than a forced update is used. We can use this as an opportunity to reinforce when you are certain
3131
* that the transition to the new props and state will not require a component update. Should the component update
32-
* returns false, than render will be completely skipped, handling the next state change. In addition
32+
* returns false, than render will be completely skipped, handling the next state change. In addition
3333
* componentWillUpdate and componentDidUpdate will not be called as well. By default shouldComponentUpdate always
3434
* return true to prevent settled bugs and state is mutated in place, but if your careful to always treat state as
3535
* immutable and to read only from properties and state in render. Than you can over ride shouldComponentUpdate with
3636
* a implentation that compares the old properties and state to their replacements
3737
* - componentWillUpdate Method
38-
* - is invoked immediately before rendering. When new properties or state are being recieved. This method is not
38+
* - is invoked immediately before rendering. When new properties or state are being recieved. This method is not
3939
* called for the inital render
4040
* - componentDidUpdate Method
4141
* - is invoked immediately after the components updates are flushed to the DOM
42-
* - This method is not called for the inital render
43-
* - We can use this method to operate on the DOM when the component
42+
* - This method is not called for the inital render
43+
* - We can use this method to operate on the DOM when the component
4444
* has been updated
4545
* - Unmount State
4646
* - componentWillUnmount Method
4747
* - is invoked immediately before a component is unmonted from the DOM. We can perform any necessary clean up in this
48-
* method or you can say garbage collection. Such as invalidating timers or clearing up any DOM elements that were
48+
* method or you can say garbage collection. Such as invalidating timers or clearing up any DOM elements that were
4949
* created in componentDidMount
50-
*
50+
*
5151
* COMPONENT STATE Methods
5252
* - render
5353
* - only returns one element
54-
* - if you do not want to return nothing at all you can simply write null or false to indicate you don't want
54+
* - if you do not want to return nothing at all you can simply write null or false to indicate you don't want
5555
* anything rendered behind the scenes
56-
* - the render function should not modify component state. It should always return the same results each time
57-
* its invoked and does not read or write to DOM. In case you need to interact with the browser, you need to
56+
* - the render function should not modify component state. It should always return the same results each time
57+
* its invoked and does not read or write to DOM. In case you need to interact with the browser, you need to
5858
* perform your work and methods like componentDidMount or other life cycle methods instead
5959
* - keeping render pure this way makes server rendering more practical and components easier to think
6060
* - getInitialState
61-
* - when ever this is invoked, once before the component is mounted, the return value will used
61+
* - when ever this is invoked, once before the component is mounted, the return value will used
6262
* as the inital value of "this.state" property
6363
* - getDefaultProps
64-
* - this invoked once and cached when the class is created. This method is invoked before any instances
64+
* - this invoked once and cached when the class is created. This method is invoked before any instances
6565
* are created and thus cannot rely on "this.props"
6666
* - in addition be aware that any complex objects return by getDefaultProps will be shared across instances and
6767
* not copied
@@ -70,10 +70,10 @@
7070
* - mixins
7171
* - a mixin is a group of methods that sits on one object that gets copied over to another object
7272
* - a fantastic method react provides us to easily reuse code
73-
* - mixins array allows you to use mixins to share behavior amoung multiple components. This will also be apart
73+
* - mixins array allows you to use mixins to share behavior amoung multiple components. This will also be apart
7474
* of reusable components.
7575
* - statics
7676
* - statics object allows you to define static methods that can be called on the component class
7777
* - displayName
7878
* - displayName is a string used in debugging msgs and usually jsx sets this value automatically
79-
*/
79+
*/

1.0-reactjsNotes/reactjsEventNotes.js

+54-54
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
* - online src http://facebook.github.io/react/docs/events.html
44
* - common occurance for events this.handle than whatever event
55
* - ex: onclick={this.handleChange} or onKeyPress={this.handlKeyPress}
6-
* - keep in mind you can't put event handlers inside another react
7-
* component, instead it gets passed in as a property.
6+
* - keep in mind you can't put event handlers inside another react
7+
* component, instead it gets passed in as a property.
88
* See buildWebAppsWithReactJSAndFlux/section4/dropdown/dropdown.jsx
9-
*
10-
*
9+
*
10+
*
1111
* - Clipboard Events
12-
* - onCopy
13-
* - onCut
12+
* - onCopy
13+
* - onCut
1414
* - onPaste
1515
* - Properties
16-
* - DOMDataTransfer
16+
* - DOMDataTransfer
1717
* - clipboardData
1818
* - Keyboard Events
19-
* - onKeyDown
20-
* - onKeyPress
19+
* - onKeyDown
20+
* - onKeyPress
2121
* - onKeyUp
2222
* - Properties
2323
* - boolean altKey
@@ -33,63 +33,63 @@
3333
* - boolean shiftKey
3434
* - Number which
3535
* Focus Events
36-
* - onFocus
36+
* - onFocus
3737
* - onBlur
3838
* - Properties
39-
* - DOMEventTarget
39+
* - DOMEventTarget
4040
* - relatedTarget
4141
* Form Events
42-
* - onChange
43-
* - onInput
42+
* - onChange
43+
* - onInput
4444
* - onSubmit
4545
* Mouse Events
46-
* - onClick
47-
* - onContextMenu
48-
* - onDoubleClick
49-
* - onDrag
50-
* - onDragEnd
51-
* - onDragEnter
52-
* - onDragExit
53-
* - onDragLeave
54-
* - onDragOver
55-
* - onDragStart
56-
* - onDrop
57-
* - onMouseDown
58-
* - onMouseEnter
59-
* - onMouseLeave
60-
* - onMouseMove
61-
* - onMouseOut
62-
* - onMouseOver
46+
* - onClick
47+
* - onContextMenu
48+
* - onDoubleClick
49+
* - onDrag
50+
* - onDragEnd
51+
* - onDragEnter
52+
* - onDragExit
53+
* - onDragLeave
54+
* - onDragOver
55+
* - onDragStart
56+
* - onDrop
57+
* - onMouseDown
58+
* - onMouseEnter
59+
* - onMouseLeave
60+
* - onMouseMove
61+
* - onMouseOut
62+
* - onMouseOver
6363
* - onMouseUp
6464
* - Properties
65-
* - boolean altKey
66-
* - Number button
67-
* - Number clientX
68-
* - Number clientY
69-
* - boolean ctrlKey
70-
* - function getModifierState(key)
71-
* - boolean metaKey
72-
* - Number pageX
73-
* - Number pageY
74-
* - DOMEventTarget
75-
* - relatedTarget
76-
* - Number screenX
77-
* - Number screenY
65+
* - boolean altKey
66+
* - Number button
67+
* - Number clientX
68+
* - Number clientY
69+
* - boolean ctrlKey
70+
* - function getModifierState(key)
71+
* - boolean metaKey
72+
* - Number pageX
73+
* - Number pageY
74+
* - DOMEventTarget
75+
* - relatedTarget
76+
* - Number screenX
77+
* - Number screenY
7878
* - boolean shiftKey
7979
* Touch events
8080
* - To enable touch events, call React.initializeTouchEvents(true)
81-
* - onTouchCancel
82-
* - onTouchEnd
83-
* - onTouchMove
81+
* - onTouchCancel
82+
* - onTouchEnd
83+
* - onTouchMove
8484
* - onTouchStart
8585
* - Properties
86-
* - boolean altKey
87-
* - DOMTouchList changedTouches
88-
* - boolean ctrlKey
89-
* - function getModifierState(key)
90-
* - boolean metaKey
91-
* - boolean shiftKey
92-
* - DOMTouchList targetTouches
86+
* - boolean altKey
87+
* - DOMTouchList changedTouches
88+
* - boolean ctrlKey
89+
* - function getModifierState(key)
90+
* - boolean metaKey
91+
* - boolean shiftKey
92+
* - DOMTouchList targetTouches
9393
* - DOMTouchList touches
9494
* UI Events
9595
* - onScroll
@@ -102,4 +102,4 @@
102102
* - Number deltaX
103103
* - Number deltaY
104104
* - Number deltaZ
105-
*/
105+
*/

0 commit comments

Comments
 (0)