├── 1_JSX
├── 1.4_JSX
│ └── README.md
├── 1.1_Intro_to_JSX
│ ├── 1.1.01_Why_React
│ │ └── README.md
│ ├── 1.1.15_JSX_Recap
│ │ └── README.md
│ ├── 1.1.04_What_is_JSX
│ │ └── README.md
│ ├── 1.1.14_The_Virtual_DOM
│ │ └── README.md
│ ├── 1.1.05_JSX_Elements
│ │ └── app.js
│ ├── 1.1.03_The_Mystery_Revealed
│ │ └── app.js
│ ├── 1.1.02_Hello_World
│ │ └── app.js
│ ├── 1.1.06_JSX_Elements_And_Their_Surroundings
│ │ └── app.js
│ ├── 1.1.07_Attributes_In_JSX
│ │ └── app.js
│ ├── 1.1.08_Nested_JSX
│ │ └── app.js
│ ├── 1.1.12_ReactDOM.render_II
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.1.10_Rendering_JSX
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.1.11_ReactDOM.render_I
│ │ ├── app.js
│ │ ├── previous.js
│ │ └── index.html
│ ├── 1.1.13_Passing_a_Variable_to_ReactDOM.render
│ │ ├── app.js
│ │ └── index.html
│ └── 1.1.09_JSX_Outer_Elements
│ │ └── blog.js
├── 1.2_Advanced_JSX
│ ├── 1.2.16_JSX_Recap
│ │ └── README.md
│ ├── 1.2.09_JSX_Conditionals_If_Statements_That_Dont_Work
│ │ └── README.md
│ ├── 1.2.15_React.createElement
│ │ ├── app.js
│ │ └── app.compiled.js
│ ├── 1.2.04_Curly_Braces_in_JSX
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.2.03_JavaScript_In_Your_JSX_In_Your_JavaScript
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.2.01_class_vs_className
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.2.06_Variables_in_JSX
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.2.05_20_Digits_of_Pi_in_JSX
│ │ ├── app.js
│ │ ├── pi.js
│ │ └── index.html
│ ├── 1.2.07_Variable_Attributes_in_JSX
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.2.02_Self-Closing_Tags
│ │ └── app.js
│ ├── 1.2.13_.map_in_JSX
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.2.14_Keys
│ │ ├── app.js
│ │ └── index.html
│ ├── 1.2.08_Event_Listeners_in_JSX
│ │ ├── index.html
│ │ └── app.js
│ ├── 1.2.12_JSX_Conditionals_And
│ │ ├── index.html
│ │ └── favorite-foods.js
│ ├── 1.2.11_JSX_Conditionals_The_Ternary_Operator
│ │ ├── index.html
│ │ └── app.js
│ └── 1.2.10_JSX_Conditionals_If_Statements_That_Do_Work
│ │ ├── index.html
│ │ ├── if.js
│ │ └── app.js
└── 1.3_Animal_Fun_Facts_Project
│ ├── images
│ ├── ocean.jpg
│ ├── dolphin.jpg
│ ├── lobster.jpg
│ └── starfish.jpg
│ ├── index.html
│ └── animals.js
├── 5_Hooks
├── 5.5_React_Hooks
│ └── README.md
├── 5.3_The_Effect_Hook
│ ├── 5.3.6_Rules_of_Hooks
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── styles.css
│ │ ├── test
│ │ │ └── test.js
│ │ └── mockBackend
│ │ │ └── data.js
│ ├── 5.3.3_Clean_Up_Effects
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── Counter.js
│ │ └── test
│ │ │ └── test.js
│ ├── 5.3.5_Fetch_Data
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── styles.css
│ │ └── test
│ │ │ └── test.js
│ ├── 5.3.2_Function_Component_Effects
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── Counter.js
│ │ └── test
│ │ │ └── test.js
│ ├── 5.3.4_Control_When_Effects_Are_Called
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── test
│ │ │ └── test.js
│ │ └── Timer.js
│ ├── 5.3.7_Separate_Hooks_for_Separate_Effects
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── test
│ │ │ └── test.js
│ │ └── styles.css
│ ├── 5.3.8_Lesson_Review
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── PageTitleFunction.js
│ │ ├── test
│ │ │ └── test.js
│ │ └── PageTitleClass.js
│ └── 5.3.1_Why_Use_useEffect
│ │ ├── PageTitleFunction.js
│ │ └── PageTitleClass.js
├── 5.2_The_State_Hook
│ ├── 5.2.5_Set_From_Previous_State
│ │ ├── index.js
│ │ ├── App.js
│ │ ├── index.html
│ │ ├── styles.css
│ │ └── test
│ │ │ └── test.js
│ ├── 5.2.6_Arrays_in_State
│ │ ├── index.js
│ │ ├── styles.css
│ │ ├── index.html
│ │ ├── ItemList.js
│ │ ├── test
│ │ │ └── test.js
│ │ └── storeItems.js
│ ├── 5.2.3_Initialize_State
│ │ ├── index.js
│ │ ├── styles.css
│ │ ├── index.html
│ │ └── ColorPicker.js
│ ├── 5.2.7_Objects_in_State
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── styles.css
│ │ └── test
│ │ │ └── test.js
│ ├── 5.2.2_Update_Function_Component_State
│ │ ├── index.js
│ │ ├── styles.css
│ │ ├── index.html
│ │ ├── test
│ │ │ └── test.js
│ │ └── ColorPicker.js
│ ├── 5.2.4_Use_State_Setter_Outside_of_JSX
│ │ ├── index.js
│ │ ├── styles.css
│ │ └── index.html
│ ├── 5.2.1_Why_Use_Hooks
│ │ ├── index.js
│ │ ├── index.html
│ │ ├── Presentational
│ │ │ ├── TasksList.js
│ │ │ └── NewTask.js
│ │ └── test
│ │ │ └── test.js
│ ├── 5.2.9_Lesson_Review
│ │ ├── index.js
│ │ ├── index.html
│ │ └── Presentational
│ │ │ ├── TasksList.js
│ │ │ └── NewTask.js
│ └── 5.2.8_Separate_Hooks_for_Separate_States
│ │ └── test
│ │ └── test.js
├── 5.4_Passing_Thoughts_Project
│ ├── utilities.js
│ └── index.html
└── 5.1_Function_Components
│ ├── 5.1.2_Function_Components_and_Props
│ ├── Friend.js
│ ├── components
│ │ └── GuineaPigs.js
│ ├── NewFriend.js
│ ├── index.html
│ └── Example.js
│ ├── 5.1.1_Stateless_Functional_Components
│ ├── Friend.js
│ ├── index.html
│ └── Example.js
│ └── 5.1.3_Review
│ ├── components
│ └── GuineaPigs.js
│ ├── index.html
│ ├── Example.js
│ └── Friend.js
├── 4_Lifecycle_Methods
├── 4.3_Lifecycle
│ └── README.md
├── 4.1_Component_Lifecycle_Methods
│ ├── 4.1.6_Review
│ │ └── README.md
│ ├── 4.1.1_The_Component_Lifecycle
│ │ └── README.md
│ ├── 4.1.2_Introduction_to_Lifecycle_Methods
│ │ └── Clock.js
│ ├── 4.1.4_componentWillUnmount
│ │ └── Clock.js
│ └── 4.1.3_componentDidMount
│ │ └── Clock.js
└── 4.2_Social_Network_for_Pets_Project
│ ├── Directory.js
│ ├── index.html
│ └── Userlist.js
├── 2_React_Components
├── 2.4_React_Components
│ └── README.md
├── 2.5_Creating_a_React_App
│ └── README.md
├── 2.1_Your_First_React_Component
│ ├── 2.1.2_Import_React
│ │ ├── news.js
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.1.3_Import_ReactDOM
│ │ ├── news.js
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.1.4_Create_a_Component_Class
│ │ ├── news.js
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.1.5_Name_a_Component_Class
│ │ ├── news.js
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.1.6_Component_Class_Instructions
│ │ ├── news.js
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.1.7_The_Render_Function
│ │ ├── news.js
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.1.8_Create_a_Component_Instance
│ │ ├── news.js
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.1.9_Render_A_Component
│ │ ├── app.js
│ │ ├── news.js
│ │ └── index.html
│ └── 2.1.1_Hello_World_Part_II_THE_COMPONENT
│ │ ├── app.js
│ │ └── index.html
├── 2.2_Components_and_Advanced_JSX
│ ├── 2.2.7_Components_Recap
│ │ └── README.md
│ ├── 2.2.5_Use_this_in_a_Component
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.2.6_Use_an_Event_Listener_in_a_Component
│ │ ├── app.js
│ │ └── index.html
│ ├── 2.2.3_Put_Logic_in_a_Render_Function
│ │ └── index.html
│ ├── 2.2.1_Use_Multiline_JSX_in_a_Component
│ │ ├── index.html
│ │ ├── app.js
│ │ └── QuoteMaker.js
│ ├── 2.2.2_Use_a_Variable_Attribute_in_a_Component
│ │ ├── index.html
│ │ ├── app.js
│ │ └── RedPanda.js
│ └── 2.2.4_Use_a_Conditional_in_a_Render_Function
│ │ ├── index.html
│ │ ├── TodaysPlan.js
│ │ └── app.js
└── 2.3_Authorization_Form
│ └── index.html
├── 3_Components_Interacting
├── 3.6_React_Developer_Tools
│ └── README.md
├── 3.3_this.state
│ ├── 3.3.1_State
│ │ └── README.md
│ ├── 3.3.7_Components_Interacting_Recap
│ │ └── README.md
│ ├── 3.3.4_Update_state_with_this.setState
│ │ └── Example.js
│ ├── 3.3.2_Setting_Initial_State
│ │ ├── index.html
│ │ ├── App.js
│ │ └── test
│ │ │ └── test.js
│ ├── 3.3.3_Access_a_Component_s_state
│ │ ├── index.html
│ │ ├── App.js
│ │ └── test
│ │ │ └── test.js
│ ├── 3.3.5_Call_this.setState_from_Another_Function
│ │ ├── index.html
│ │ ├── Mood.js
│ │ └── Toggle.js
│ └── 3.3.6_this.setState_Automatically_Calls_render
│ │ ├── index.html
│ │ ├── Mood.js
│ │ └── Toggle.js
├── 3.5_Components_Interacting
│ └── README.md
├── 3.2_this.props
│ ├── 3.2.01_this.props
│ │ └── README.md
│ ├── 3.2.13_this.props_Recap
│ │ └── README.md
│ ├── 3.2.05_Pass_props_From_Component_To_Component
│ │ ├── Greeting.js
│ │ ├── StewDescriber.js
│ │ ├── index.html
│ │ ├── App.js
│ │ ├── MainPage.js
│ │ └── test
│ │ │ └── test.js
│ ├── 3.2.07_Put_an_Event_Handler_in_a_Component_Class
│ │ ├── Button.js
│ │ ├── Example.js
│ │ ├── index.html
│ │ └── Talker.js
│ ├── 3.2.11_this.props.children
│ │ ├── BigButton.js
│ │ ├── index.html
│ │ ├── List.js
│ │ └── App.js
│ ├── 3.2.08_Pass_an_Event_Handler_as_a_prop
│ │ ├── Button.js
│ │ ├── index.html
│ │ └── Talker.js
│ ├── 3.2.09_Receive_an_Event_Handler_as_a_prop
│ │ ├── Button.js
│ │ ├── index.html
│ │ ├── Talker.js
│ │ └── test
│ │ │ └── test.js
│ ├── 3.2.10_handleEvent_onEvent_and_this.props.onEvent
│ │ ├── Button.js
│ │ ├── index.html
│ │ ├── Talker.js
│ │ └── test
│ │ │ └── test.js
│ ├── 3.2.04_Render_a_Component_s_props
│ │ ├── Greeting.js
│ │ └── index.html
│ ├── 3.2.06_Render_Different_UI_Based_on_props
│ │ ├── Home.js
│ │ ├── Greeting.js
│ │ ├── index.html
│ │ ├── Welcome.js
│ │ ├── App.js
│ │ └── test
│ │ │ └── test.js
│ ├── 3.2.12_defaultProps
│ │ ├── index.html
│ │ ├── Button.js
│ │ └── test
│ │ │ └── test.js
│ ├── 3.2.02_Access_a_Component_s_props
│ │ ├── index.html
│ │ └── PropsDisplayer.js
│ └── 3.2.03_Pass_props_to_a_Component
│ │ ├── index.html
│ │ └── PropsDisplayer.js
├── 3.4_Random_Color_Picker
│ ├── Button.js
│ └── index.html
└── 3.1_Components_Render_Other_Components
│ ├── index.html
│ ├── NavBar.js
│ ├── AnteaterProfile.js
│ ├── ProfilePage.js
│ └── MainPage.js
├── 7_Additional_React_Basics
├── 7.4_React_Forms
│ ├── 7.4.1_React_Forms
│ │ └── README.md
│ ├── 7.4.7_React_Forms_Recap
│ │ └── README.md
│ ├── 7.4.6_Controlled_vs_Uncontrolled
│ │ ├── Input.js
│ │ ├── index.html
│ │ └── Example.js
│ ├── 7.4.2_Input_onChange
│ │ ├── index.html
│ │ ├── Input.js
│ │ └── Example.js
│ ├── 7.4.5_Update_an_Input_s_Value
│ │ ├── index.html
│ │ └── Example.js
│ ├── 7.4.3_Write_an_Input_Event_Handler
│ │ ├── index.html
│ │ ├── Example.js
│ │ └── Input.js
│ └── 7.4.4_Set_the_Input_s_Initial_State
│ │ ├── index.html
│ │ ├── Example.js
│ │ └── Input.js
├── 7.7_Additional_React_Basics_Quiz
│ └── README.md
├── 7.5_What_are_Uncontrolled_Components
│ └── README.md
├── 7.1_Style
│ ├── 7.1.1_Advanced_React_Techniques
│ │ └── README.md
│ ├── 7.1.2_Inline_Styles
│ │ ├── styleMe.js
│ │ └── index.html
│ ├── 7.1.3_Make_A_Style_Object_Variable
│ │ ├── styleMe.js
│ │ ├── Example.js
│ │ └── index.html
│ ├── 7.1.4_Style_Name_Syntax
│ │ ├── Example.js
│ │ ├── styleMe.js
│ │ └── index.html
│ ├── 7.1.5_Style_Value_Syntax
│ │ ├── Example.js
│ │ ├── styleMe.js
│ │ └── index.html
│ └── 7.1.6_Share_Styles_Across_Multiple_Components
│ │ ├── facebookStyles.js
│ │ ├── index.html
│ │ ├── AttentionGrabber.js
│ │ ├── styles.js
│ │ ├── FacebookColorThief.js
│ │ └── Hume.js
├── 7.2_Container_Components_From_Presentational_Components
│ ├── 7.2.3_Separate_Presentational_Component
│ │ ├── containers
│ │ │ └── GuineaPigsContainer.compiled.js
│ │ └── index.html
│ ├── 7.2.6_Review
│ │ ├── components
│ │ │ └── GuineaPigs.js
│ │ └── index.html
│ ├── 7.2.2_Create_Container_Component
│ │ ├── test
│ │ │ └── test.js
│ │ └── index.html
│ ├── 7.2.5_Remove_Logic_from_Presentational_Component
│ │ ├── components
│ │ │ └── GuineaPigs.js
│ │ └── index.html
│ ├── 7.2.1_Separate_Container_Components_From_Presentational_Components
│ │ └── index.html
│ └── 7.2.4_Render_Presentational_Component_in_Container_Component
│ │ └── index.html
├── 7.3_PropTypes
│ ├── 7.3.1_propTypes
│ │ ├── MessageDisplayer.js
│ │ ├── index.html
│ │ └── BestSeller.js
│ ├── 7.3.2_Apply_PropTypes
│ │ ├── MessageDisplayer.js
│ │ ├── index.html
│ │ └── BestSeller.js
│ ├── 7.3.3_Add_Properties_to_PropTypes
│ │ ├── MessageDisplayer.js
│ │ ├── index.html
│ │ └── BestSeller.js
│ └── 7.3.4_PropTypes_in_Function_Components
│ │ ├── components
│ │ └── GuineaPigs.js
│ │ ├── index.html
│ │ ├── Example.js
│ │ └── test
│ │ └── test.js
└── 7.6_Copycat_Project
│ ├── index.html
│ └── index.css
├── images
└── cover.png
├── 6_Stateless_Component_From_Stateful_Components
├── 6.5_Stateful_and_Stateless_Programming_Patterns
│ └── README.md
├── 6.1_Stateless_Components_From_Stateful_Components
│ ├── 6.1.2_Build_a_Stateful_Component_Class
│ │ ├── Child.js
│ │ ├── Parent.js
│ │ ├── index.html
│ │ └── test
│ │ │ └── test.js
│ ├── 6.1.1_Stateless_Components_Inherit_From_Stateful_Components
│ │ └── README.md
│ ├── 6.1.4_Pass_a_Component_s_State
│ │ ├── Child.js
│ │ ├── index.html
│ │ ├── Parent.js
│ │ └── test
│ │ │ └── test.js
│ ├── 6.1.3_Build_a_Stateless_Component_Class
│ │ ├── Child.js
│ │ ├── Parent.js
│ │ ├── index.html
│ │ └── test
│ │ │ └── test.js
│ └── 6.1.5_Don_t_Update_props
│ │ └── Bad.js
├── 6.3_Child_Components_Update_Their_Siblings_props
│ ├── 6.3.1_Child_Components_Update_Sibling_Components
│ │ └── README.md
│ ├── 6.3.2_One_Sibling_to_Display,_Another_to_Change
│ │ ├── Sibling.js
│ │ └── index.html
│ ├── 6.3.3_Pass_the_Right_props_to_the_Right_Siblings
│ │ ├── Sibling.js
│ │ └── index.html
│ ├── 6.3.4_Display_Information_in_a_Sibling_Component
│ │ ├── index.html
│ │ ├── Sibling.js
│ │ └── test
│ │ │ └── test.js
│ └── 6.3.5_Stateless_Components_Inherit_From_Stateful_Components_Recap
│ │ ├── index.html
│ │ └── Sibling.js
├── 6.4_Video_Player_Project
│ ├── index.html
│ ├── Video.js
│ ├── styles.css
│ └── Menu.js
└── 6.2_Child_Components_Update_Their_Parents_state
│ ├── 6.2.5_Automatic_Binding
│ ├── index.html
│ └── Parent.js
│ ├── 6.2.2_Define_an_Event_Handler
│ ├── index.html
│ ├── Parent.js
│ └── Child.js
│ ├── 6.2.3_Pass_the_Event_Handler
│ ├── index.html
│ ├── Parent.js
│ ├── Child.js
│ └── test
│ │ └── test.js
│ ├── 6.2.4_Receive_the_Event_Handler
│ ├── index.html
│ └── Parent.js
│ └── 6.2.1_Child_Components_Update_Their_Parents_state
│ ├── Step3.js
│ └── Step1.js
└── README.md
/1_JSX/1.4_JSX/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/5_Hooks/5.5_React_Hooks/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.3_Lifecycle/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.01_Why_React/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.15_JSX_Recap/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.16_JSX_Recap/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/2_React_Components/2.4_React_Components/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.04_What_is_JSX/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.14_The_Virtual_DOM/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/2_React_Components/2.5_Creating_a_React_App/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.05_JSX_Elements/app.js:
--------------------------------------------------------------------------------
1 | const h1 =
Hello world
;
2 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.6_React_Developer_Tools/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.1_State/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.5_Components_Interacting/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.03_The_Mystery_Revealed/app.js:
--------------------------------------------------------------------------------
1 | const h1 = Hello world ;
2 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.01_this.props/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.1_React_Forms/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.7_Additional_React_Basics_Quiz/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.13_this.props_Recap/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.1_Component_Lifecycle_Methods/4.1.6_Review/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.7_React_Forms_Recap/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.5_What_are_Uncontrolled_Components/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.02_Hello_World/app.js:
--------------------------------------------------------------------------------
1 | // Hello world
2 | const h1 = Hello world ;
3 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.2_Import_React/news.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.1_Advanced_React_Techniques/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.09_JSX_Conditionals_If_Statements_That_Dont_Work/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.7_Components_Recap/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.7_Components_Interacting_Recap/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/images/cover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/somekindofwallflower/codecademy-learn-react-2022/main/images/cover.png
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.1_Component_Lifecycle_Methods/4.1.1_The_Component_Lifecycle/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.06_JSX_Elements_And_Their_Surroundings/app.js:
--------------------------------------------------------------------------------
1 | const myArticle = My article ;
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.07_Attributes_In_JSX/app.js:
--------------------------------------------------------------------------------
1 | const p1 = foo
;
2 | const p2 = bar
;
3 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.5_Stateful_and_Stateless_Programming_Patterns/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.08_Nested_JSX/app.js:
--------------------------------------------------------------------------------
1 | const myDiv = (
2 |
3 |
Hello world
4 |
5 | );
6 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.3_Import_ReactDOM/news.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.2_Build_a_Stateful_Component_Class/Child.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.12_ReactDOM.render_II/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // Write code here:
5 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.15_React.createElement/app.js:
--------------------------------------------------------------------------------
1 | const greatestDivEver = React.createElement(
2 | "div",
3 | null,
4 | "i am div"
5 | );
6 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.3_Separate_Presentational_Component/containers/GuineaPigsContainer.compiled.js:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Codecademy_Learn_React
2 | Codecademy - Learn React Course
3 |
4 | https://www.codecademy.com/courses/react-101/
5 |
6 | 
7 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.1_Child_Components_Update_Sibling_Components/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/1_JSX/1.3_Animal_Fun_Facts_Project/images/ocean.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/somekindofwallflower/codecademy-learn-react-2022/main/1_JSX/1.3_Animal_Fun_Facts_Project/images/ocean.jpg
--------------------------------------------------------------------------------
/1_JSX/1.3_Animal_Fun_Facts_Project/images/dolphin.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/somekindofwallflower/codecademy-learn-react-2022/main/1_JSX/1.3_Animal_Fun_Facts_Project/images/dolphin.jpg
--------------------------------------------------------------------------------
/1_JSX/1.3_Animal_Fun_Facts_Project/images/lobster.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/somekindofwallflower/codecademy-learn-react-2022/main/1_JSX/1.3_Animal_Fun_Facts_Project/images/lobster.jpg
--------------------------------------------------------------------------------
/1_JSX/1.3_Animal_Fun_Facts_Project/images/starfish.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/somekindofwallflower/codecademy-learn-react-2022/main/1_JSX/1.3_Animal_Fun_Facts_Project/images/starfish.jpg
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.1_Stateless_Components_Inherit_From_Stateful_Components/README.md:
--------------------------------------------------------------------------------
1 | No code in this section
2 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.4_Create_a_Component_Class/news.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class x extends React.Component { }
5 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.5_Name_a_Component_Class/news.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component { }
5 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.10_Rendering_JSX/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // Copy code here:
5 | ReactDOM.render(Hello world , document.getElementById('app'));
6 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.6_Component_Class_Instructions/news.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component { }
5 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.11_ReactDOM.render_I/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // Write code here:
5 | ReactDOM.render(Render me! , document.getElementById('app'));
6 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.04_Curly_Braces_in_JSX/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // Write code here:
5 | ReactDOM.render(
6 | {2 + 3} ,
7 | document.getElementById('app')
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.6_Rules_of_Hooks/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import Shop from "./Shop";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.5_Set_From_Previous_State/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import App from "./App";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.3_Clean_Up_Effects/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import Counter from "./Counter";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.5_Fetch_Data/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import Forecast from "./Forecast";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.03_JavaScript_In_Your_JSX_In_Your_JavaScript/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // Write code here:
5 | ReactDOM.render(
6 | 2 + 3 ,
7 | document.getElementById('app')
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.6_Arrays_in_State/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import GroceryCart from "./GroceryCart";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.2_Function_Component_Effects/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import Counter from "./Counter";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.4_Control_When_Effects_Are_Called/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import Timer from "./Timer";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.01_class_vs_className/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // Write code here:
5 | const myDiv = I AM A BIG DIV
6 | ReactDOM.render(myDiv, document.getElementById('app'));
7 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.3_Initialize_State/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import ColorPicker from "./ColorPicker";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.7_Objects_in_State/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import EditProfile from "./EditProfile";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.11_ReactDOM.render_I/previous.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // This is just an example, switch to app.js for the exercise.
5 | ReactDOM.render(Hello world , document.getElementById('app'));
6 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.05_Pass_props_From_Component_To_Component/Greeting.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Greeting extends React.Component {
4 | render() {
5 | return Hi there, {this.props.name}! ;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.5_Set_From_Previous_State/App.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import QuizNavBar from "./QuizNavBar";
3 | import { questions } from "./dataModel";
4 |
5 | export default function App() {
6 | return ;
7 | }
8 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.7_The_Render_Function/news.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.2_Update_Function_Component_State/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import ColorPicker from "./ColorPicker";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.4_Use_State_Setter_Outside_of_JSX/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import PhoneNumber from "./PhoneNumber";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.4_Passing_Thoughts_Project/utilities.js:
--------------------------------------------------------------------------------
1 | export function getNewExpirationTime() {
2 | return Date.now() + 15 * 1000;
3 | }
4 |
5 | let nextId = 0;
6 | export function generateId() {
7 | const result = nextId;
8 | nextId += 1;
9 | return result;
10 | }
11 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.06_Variables_in_JSX/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const theBestString = 'tralalalala i am da best';
5 |
6 | ReactDOM.render(
7 | {theBestString} ,
8 | document.getElementById('app')
9 | );
10 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.7_Separate_Hooks_for_Separate_Effects/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import SocialNetwork from "./SocialNetwork";
4 |
5 | ReactDOM.render(
6 | ,
7 | document.getElementById("app")
8 | );
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.1_Why_Use_Hooks/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | // import App from "./Container/AppClass";
4 | import App from "./Container/AppFunction";
5 |
6 | ReactDOM.render(
7 | ,
8 | document.getElementById("app")
9 | );
10 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.05_20_Digits_of_Pi_in_JSX/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // Write code here:
5 | const math = (
6 | 2 + 3 = {2 + 3}
7 | );
8 |
9 | ReactDOM.render(
10 | math,
11 | document.getElementById('app')
12 | );
13 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.9_Lesson_Review/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | // import App from "./Container/AppClass";
4 | import App from "./Container/AppFunction";
5 |
6 | ReactDOM.render(
7 | ,
8 | document.getElementById("app")
9 | );
10 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.8_Lesson_Review/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | // import PageTitle from "./PageTitleClass";
4 | import PageTitle from "./PageTitleFunction";
5 |
6 | ReactDOM.render(
7 | ,
8 | document.getElementById("app")
9 | );
10 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.4_Pass_a_Component_s_State/Child.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 |
3 | export class Child extends Component {
4 | render() {
5 | return Hey, my name is {this.props.name}! ;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.3_Build_a_Stateless_Component_Class/Child.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 |
3 | export class Child extends Component {
4 | render() {
5 | return Hey, my name is {this.props.name}! ;
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.07_Put_an_Event_Handler_in_a_Component_Class/Button.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Button extends React.Component {
4 | render() {
5 | return (
6 |
7 | Click me!
8 |
9 | );
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.11_this.props.children/BigButton.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { LilButton } from './LilButton';
3 |
4 | class BigButton extends React.Component {
5 | render() {
6 | console.log(this.props.children);
7 | return Yo I am big ;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.5_Don_t_Update_props/Bad.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | class Bad extends React.Component {
4 | render() {
5 | this.props.message = 'yo'; // NOOOOOOOOOOOOOO!!!
6 | return {this.props.message} ;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.2_Function_Components_and_Props/Friend.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 |
5 |
6 | export class Friend extends React.Component {
7 | render() {
8 | return ;
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.8_Create_a_Component_Instance/news.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | // component goes here:
11 |
12 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.08_Pass_an_Event_Handler_as_a_prop/Button.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Button extends React.Component {
4 | render() {
5 | return (
6 |
7 | Click me!
8 |
9 | );
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.09_Receive_an_Event_Handler_as_a_prop/Button.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Button extends React.Component {
4 | render() {
5 | return (
6 |
7 | Click me!
8 |
9 | );
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.13_Passing_a_Variable_to_ReactDOM.render/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // Write code here:
5 | const myList = (
6 |
7 | Learn React
8 | Become a Developer
9 |
10 | )
11 |
12 | ReactDOM.render(myList, document.getElementById('app'));
13 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.10_handleEvent_onEvent_and_this.props.onEvent/Button.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Button extends React.Component {
4 | render() {
5 | return (
6 |
7 | Click me!
8 |
9 | );
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.07_Variable_Attributes_in_JSX/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const goose = 'https://content.codecademy.com/courses/React/react_photo-goose.jpg';
5 |
6 | // Declare new variable here:
7 | const gooseImg = ;
8 |
9 | ReactDOM.render(gooseImg, document.getElementById('app'));
10 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.09_JSX_Outer_Elements/blog.js:
--------------------------------------------------------------------------------
1 | const blog = (
2 |
3 |
4 |
5 | Welcome to Dan's Blog!
6 |
7 |
8 | Wow I had the tastiest sandwich today. I literally almost freaked out.
9 |
10 |
11 | );
12 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.02_Self-Closing_Tags/app.js:
--------------------------------------------------------------------------------
1 | const profile = (
2 |
3 |
I AM JENKINS
4 |
5 |
6 | I LIKE TO SIT
7 |
8 | JENKINS IS MY NAME
9 |
10 | THANKS HA LOT
11 |
12 |
13 | );
14 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.2_Import_React/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.3_Import_ReactDOM/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.1_Stateless_Functional_Components/Friend.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | export const Friend = () => {
5 | return ;
6 | };
7 |
8 | ReactDOM.render(
9 | ,
10 | document.getElementById('app')
11 | );
12 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.7_The_Render_Function/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.9_Render_A_Component/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.4_Create_a_Component_Class/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.5_Name_a_Component_Class/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.2_Inline_Styles/styleMe.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const styleMe = Please style me! I am so bland! ;
10 |
11 | ReactDOM.render(
12 | styleMe,
13 | document.getElementById('app')
14 | );
15 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.13_.map_in_JSX/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const people = ['Rowe', 'Prevost', 'Gare'];
5 |
6 | const peopleLis = people.map(person =>
7 | // expression goes here:
8 | {person}
9 | );
10 |
11 | // ReactDOM.render goes here:
12 | ReactDOM.render(, document.getElementById('app'));
13 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.6_Component_Class_Instructions/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.8_Create_a_Component_Instance/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.3_Review/components/GuineaPigs.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class GuineaPigs extends React.Component {
4 | render() {
5 | let src = this.props.src;
6 | return (
7 |
8 |
Cute Guinea Pigs
9 |
10 |
11 | );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.1_Hello_World_Part_II_THE_COMPONENT/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | };
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.05_20_Digits_of_Pi_in_JSX/pi.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const pi = (
5 |
6 |
7 | PI, YALL!
8 |
9 |
10 | {Math.PI.toFixed(20)}
11 |
12 |
13 | );
14 |
15 | ReactDOM.render(
16 | pi,
17 | document.getElementById('app')
18 | );
19 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.6_Arrays_in_State/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: left;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | position: relative;
15 | height: 100%;
16 | width: 100%;
17 | padding: 8px;
18 | }
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.3_Make_A_Style_Object_Variable/styleMe.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const styles = {
5 | background: 'lightblue',
6 | color: 'darkred',
7 | };
8 |
9 | const styleMe = Please style me! I am so bland! ;
10 |
11 | ReactDOM.render(
12 | styleMe,
13 | document.getElementById('app')
14 | );
15 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.14_Keys/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const people = ['Rowe', 'Prevost', 'Gare'];
5 |
6 | const peopleLis = people.map((person, i) =>
7 | // expression goes here:
8 | {person}
9 | );
10 |
11 | // ReactDOM.render goes here:
12 | ReactDOM.render(, document.getElementById('app'));
13 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.9_Render_A_Component/news.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyComponentClass extends React.Component {
5 | render() {
6 | return Hello world ;
7 | }
8 | }
9 |
10 | // component goes here:
11 | ReactDOM.render(
12 | ,
13 | document.getElementById('app')
14 | );
15 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.04_Render_a_Component_s_props/Greeting.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class Greeting extends React.Component {
5 | render() {
6 | return Hi there, {this.props.firstName} ;
7 | }
8 | }
9 |
10 | ReactDOM.render(
11 | ,
12 | document.getElementById('app')
13 | );
14 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.4_Style_Name_Syntax/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const styles = {
4 | color: 'darkcyan',
5 | background: 'mintcream'
6 | };
7 |
8 | export class StyledClass extends React.Component {
9 | render() {
10 | return (
11 |
12 | Hello world
13 |
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.5_Style_Value_Syntax/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const styles = {
4 | color: 'darkcyan',
5 | background: 'mintcream'
6 | };
7 |
8 | export class StyledClass extends React.Component {
9 | render() {
10 | return (
11 |
12 | Hello world
13 |
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.2_Function_Components_and_Props/components/GuineaPigs.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class GuineaPigs extends React.Component {
4 | render() {
5 | let src = this.props.src;
6 | return (
7 |
8 |
Cute Guinea Pigs
9 |
10 |
11 | );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.3_Make_A_Style_Object_Variable/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | const styles = {
4 | color: 'darkcyan',
5 | background: 'mintcream'
6 | };
7 |
8 | export class StyledClass extends React.Component {
9 | render() {
10 | return (
11 |
12 | Hello world
13 |
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/1_JSX/1.3_Animal_Fun_Facts_Project/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.06_Render_Different_UI_Based_on_props/Home.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Welcome } from './Welcome';
4 |
5 | class Home extends React.Component {
6 | render() {
7 | return ;
8 | }
9 | }
10 |
11 | ReactDOM.render(
12 | ,
13 | document.getElementById('app')
14 | );
15 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.4_Update_state_with_this.setState/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | class Example extends React.Component {
4 | constructor(props) {
5 | super(props);
6 | this.state = {
7 | mood: 'great',
8 | hungry: false
9 | };
10 | }
11 |
12 | render() {
13 | return
;
14 | }
15 | }
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.06_Render_Different_UI_Based_on_props/Greeting.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | export class Greeting extends React.Component {
5 | render() {
6 | if (this.props.signedIn === false) {
7 | return GO AWAY ;
8 | } else {
9 | return Hi there, {this.props.name}! ;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.4_Random_Color_Picker/Button.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Button extends React.Component {
4 | render() {
5 | return (
6 |
10 | Refresh
11 |
12 | );
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.2_Build_a_Stateful_Component_Class/Parent.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 |
3 | class Parent extends Component {
4 | constructor(props) {
5 | super(props);
6 | this.state = {
7 | name: "Frarthur"
8 | };
9 | }
10 |
11 | render() {
12 | return
;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.3_Build_a_Stateless_Component_Class/Parent.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 |
3 | class Parent extends Component {
4 | constructor(props) {
5 | super(props);
6 | this.state = {
7 | name: "Frarthur"
8 | };
9 | }
10 |
11 | render() {
12 | return
;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.6_Review/components/GuineaPigs.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class GuineaPigs extends React.Component {
4 | render() {
5 | let src = this.props.src
6 | return (
7 |
8 |
Cute Guinea Pigs
9 |
10 |
11 | );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.5_Style_Value_Syntax/styleMe.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const styles = {
5 | background: 'lightblue',
6 | color: 'darkred',
7 | marginTop: 100,
8 | fontSize: 50,
9 | };
10 |
11 | const styleMe = Please style me! I am so bland! ;
12 |
13 | ReactDOM.render(
14 | styleMe,
15 | document.getElementById('app')
16 | );
17 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.4_Style_Name_Syntax/styleMe.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const styles = {
5 | background: 'lightblue',
6 | color: 'darkred',
7 | marginTop: '100px',
8 | fontSize: '50px',
9 | };
10 |
11 | const styleMe = Please style me! I am so bland! ;
12 |
13 | ReactDOM.render(
14 | styleMe,
15 | document.getElementById('app')
16 | );
17 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.5_Use_this_in_a_Component/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class MyName extends React.Component {
5 | // name property goes here:
6 | get name() {
7 | return 'John';
8 | }
9 |
10 | render() {
11 | return My name is {this.name}. ;
12 | }
13 | }
14 |
15 | ReactDOM.render( , document.getElementById('app'));
16 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.2_Create_Container_Component/test/test.js:
--------------------------------------------------------------------------------
1 | describe('', function () {
2 | it('', function () {
3 | expect(() => {
4 | require('../containers/GuineaPigsContainer.js');
5 | }, 'Make sure that **GuineaPigsContainer.js** is in a folder named `containers`, and ensure that folder is neighbors with the `components` folder.').to.not.throw();
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.1_propTypes/MessageDisplayer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | export class MessageDisplayer extends React.Component {
5 | render() {
6 | return {this.props.message} ;
7 | }
8 | }
9 |
10 | // This propTypes object should have
11 | // one property for each expected prop:
12 | MessageDisplayer.propTypes = {
13 | message: PropTypes.string
14 | };
15 |
--------------------------------------------------------------------------------
/2_React_Components/2.3_Authorization_Form/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Login
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.2_Social_Network_for_Pets_Project/Directory.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Userlist } from './Userlist';
3 |
4 | export function Directory(props) {
5 | return (
6 |
7 |
User directory
8 |
12 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.2_Apply_PropTypes/MessageDisplayer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | export class MessageDisplayer extends React.Component {
5 | render() {
6 | return {this.props.message} ;
7 | }
8 | }
9 |
10 | // This propTypes object should have
11 | // one property for each expected prop:
12 | MessageDisplayer.propTypes = {
13 | message: PropTypes.string
14 | };
15 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.3_Review/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.01_class_vs_className/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.06_Variables_in_JSX/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.14_Keys/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.2_Function_Components_and_Props/NewFriend.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | export const NewFriend = (props) => {
5 | return (
6 |
7 |
8 |
9 | );
10 | }
11 |
12 | ReactDOM.render(
13 | ,
14 | document.getElementById('app')
15 | );
16 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.04_Curly_Braces_in_JSX/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.05_20_Digits_of_Pi_in_JSX/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.4_Random_Color_Picker/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Random Color
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.1_Why_Use_Hooks/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.3_Initialize_State/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: center;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | position: relative;
15 | height: 100%;
16 | width: 100%;
17 | padding: 4px;
18 | }
19 |
20 | div {
21 | padding: 20px 0 0;
22 | height: 100%;
23 | }
24 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.5_Remove_Logic_from_Presentational_Component/components/GuineaPigs.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class GuineaPigs extends React.Component {
4 | render() {
5 | let src = this.props.src
6 | return (
7 |
8 |
Cute Guinea Pigs
9 |
10 |
11 | );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.3_Add_Properties_to_PropTypes/MessageDisplayer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | export class MessageDisplayer extends React.Component {
5 | render() {
6 | return {this.props.message} ;
7 | }
8 | }
9 |
10 | // This propTypes object should have
11 | // one property for each expected prop:
12 | MessageDisplayer.propTypes = {
13 | message: PropTypes.string
14 | };
15 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.4_PropTypes_in_Function_Components/components/GuineaPigs.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | export const GuineaPigs = (props) => {
5 | let src = props.src;
6 | return (
7 |
8 |
Cute Guinea Pigs
9 |
10 |
11 | );
12 | }
13 |
14 | GuineaPigs.propTypes = {
15 | src: PropTypes.string.isRequired
16 | };
17 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.10_Rendering_JSX/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.12_ReactDOM.render_II/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.07_Variable_Attributes_in_JSX/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.13_.map_in_JSX/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/5_Hooks/5.4_Passing_Thoughts_Project/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Passing Thoughts
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.11_ReactDOM.render_I/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.2_Social_Network_for_Pets_Project/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | PetBook
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.5_Set_From_Previous_State/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.9_Lesson_Review/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.5_Fetch_Data/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.8_Lesson_Review/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.6_Copycat_Project/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | CopyCat
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.08_Event_Listeners_in_JSX/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.2_Import_React/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.1_Stateless_Functional_Components/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.2_Function_Components_and_Props/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.2_Update_Function_Component_State/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: center;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | position: relative;
15 | height: 100%;
16 | width: 100%;
17 | padding: 4px;
18 | }
19 |
20 | div {
21 | padding: 20px 0 0;
22 | height: 100%;
23 | }
24 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.3_Initialize_State/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.4_Use_State_Setter_Outside_of_JSX/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: center;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | position: relative;
15 | height: 100%;
16 | width: 100%;
17 | padding: 4px;
18 | }
19 |
20 | div {
21 | padding: 20px 0 0;
22 | height: 100%;
23 | }
24 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.6_Arrays_in_State/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.7_Objects_in_State/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.3_Clean_Up_Effects/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.6_Rules_of_Hooks/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.6_Share_Styles_Across_Multiple_Components/facebookStyles.js:
--------------------------------------------------------------------------------
1 | // facebook color palette
2 |
3 | const blue = 'rgb(139, 157, 195)';
4 | const darkBlue = 'rgb(059, 089, 152)';
5 | const lightBlue = 'rgb(223, 227, 238)';
6 | const grey = 'rgb(247, 247, 247)';
7 | const white = 'rgb(255, 255, 255)';
8 |
9 | const colorStyles = {
10 | blue: blue,
11 | darkBlue: darkBlue,
12 | lightBlue: lightBlue,
13 | grey: grey,
14 | white: white
15 | };
16 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.03_JavaScript_In_Your_JSX_In_Your_JavaScript/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.3_Import_ReactDOM/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.12_defaultProps/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.2_Update_Function_Component_State/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.4_Video_Player_Project/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Video Player
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.2_Inline_Styles/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.6_Controlled_vs_Uncontrolled/Input.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | export class Input extends React.Component {
5 | render() {
6 | return (
7 |
8 |
9 |
I am an h1.
10 |
11 | );
12 | }
13 | }
14 |
15 | ReactDOM.render(
16 | ,
17 | document.getElementById('app')
18 | );
19 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.12_JSX_Conditionals_And/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.5_Name_a_Component_Class/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.7_The_Render_Function/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.11_this.props.children/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.2_Setting_Initial_State/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.5_Set_From_Previous_State/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: center;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | position: relative;
15 | height: 100%;
16 | width: 100%;
17 | padding: 8px;
18 | }
19 |
20 | nav {
21 | display: flex;
22 | justify-content: space-between;
23 | }
24 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.7_Objects_in_State/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: left;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | position: relative;
15 | height: 100%;
16 | width: 100%;
17 | padding: 8px;
18 | }
19 |
20 | input {
21 | width: 90%;
22 | max-width: 300px;
23 | margin: 5px 5%;
24 | }
25 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.2_Function_Component_Effects/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.4_Style_Name_Syntax/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.5_Style_Value_Syntax/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.1_propTypes/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.2_Input_onChange/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/1_JSX/1.1_Intro_to_JSX/1.1.13_Passing_a_Variable_to_ReactDOM.render/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.11_JSX_Conditionals_The_Ternary_Operator/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.4_Create_a_Component_Class/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.1_Components_Render_Other_Components/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.07_Put_an_Event_Handler_in_a_Component_Class/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | class Example extends React.Component {
4 | handleEvent() {
5 | alert(`I am an event handler.
6 | If you see this message,
7 | then I have been called.`);
8 | }
9 |
10 | render() {
11 | return (
12 |
13 | Hello world
14 |
15 | );
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.3_Access_a_Component_s_state/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.4_Use_State_Setter_Outside_of_JSX/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.4_Control_When_Effects_Are_Called/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.4_Video_Player_Project/Video.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Video extends React.Component {
4 | render() {
5 | return (
6 |
7 |
14 |
15 | );
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.2_Apply_PropTypes/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.10_JSX_Conditionals_If_Statements_That_Do_Work/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.6_Component_Class_Instructions/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.9_Render_A_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.6_Use_an_Event_Listener_in_a_Component/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class Button extends React.Component {
5 | scream() {
6 | alert('AAAAAAAAHHH!!!!!');
7 | }
8 |
9 | render() {
10 | return AAAAAH! ;
13 | }
14 | }
15 |
16 | ReactDOM.render(
17 | ,
18 | document.getElementById('app')
19 | );
20 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.7_Separate_Hooks_for_Separate_Effects/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.3_Make_A_Style_Object_Variable/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.5_Update_an_Input_s_Value/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.5_Use_this_in_a_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.04_Render_a_Component_s_props/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.05_Pass_props_From_Component_To_Component/StewDescriber.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class StewDescriber extends React.Component {
4 | render() {
5 | return (
6 |
7 |
I AM THE STEW DESCRIBER ;
8 | THE WORLD'S GREATEST STEW IS {this.props.stew.toUpperCase()}!
9 | HERE'S MY DESCRIPTION: IT'S MAD TASTY
10 |
11 | );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.06_Render_Different_UI_Based_on_props/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.08_Pass_an_Event_Handler_as_a_prop/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.3_Add_Properties_to_PropTypes/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.3_Write_an_Input_Event_Handler/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.4_Set_the_Input_s_Initial_State/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.6_Controlled_vs_Uncontrolled/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.8_Create_a_Component_Instance/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.3_Put_Logic_in_a_Render_Function/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.02_Access_a_Component_s_props/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.03_Pass_props_to_a_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.05_Pass_props_From_Component_To_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.09_Receive_an_Event_Handler_as_a_prop/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.6_Share_Styles_Across_Multiple_Components/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.1_Your_First_React_Component/2.1.1_Hello_World_Part_II_THE_COMPONENT/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.1_Use_Multiline_JSX_in_a_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.07_Put_an_Event_Handler_in_a_Component_Class/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.10_handleEvent_onEvent_and_this.props.onEvent/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.11_this.props.children/List.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class List extends React.Component {
4 | render() {
5 | let titleText = `Favorite ${this.props.type}`;
6 | if (this.props.children instanceof Array) {
7 | titleText += 's';
8 | }
9 | return (
10 |
11 |
{titleText}
12 |
13 |
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.5_Call_this.setState_from_Another_Function/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.6_this.setState_Automatically_Calls_render/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.6_Share_Styles_Across_Multiple_Components/AttentionGrabber.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { styles } from './styles';
3 |
4 | const h1Style = {
5 | color: styles.color,
6 | fontSize: styles.fontSize,
7 | fontFamily: styles.fontFamily,
8 | padding: styles.padding,
9 | margin: 0,
10 | };
11 |
12 | export class AttentionGrabber extends React.Component {
13 | render() {
14 | return WELCOME TO MY HOMEPAGE! ;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.2_Use_a_Variable_Attribute_in_a_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.4_Use_a_Conditional_in_a_Render_Function/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.6_Use_an_Event_Listener_in_a_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.4_PropTypes_in_Function_Components/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.1_Components_Render_Other_Components/NavBar.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class NavBar extends React.Component {
4 | render() {
5 | const pages = ['home', 'blog', 'pics', 'bio', 'art', 'shop', 'about', 'contact'];
6 | const navLinks = pages.map(page => {
7 | return (
8 |
9 | {page}
10 |
11 | )
12 | });
13 |
14 | return {navLinks} ;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.12_defaultProps/Button.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class Button extends React.Component {
5 | render() {
6 | return (
7 |
8 | {this.props.text}
9 |
10 | );
11 | }
12 | }
13 |
14 | // defaultProps goes here:
15 | Button.defaultProps = { text: 'I am a button' };
16 |
17 | ReactDOM.render(
18 | ,
19 | document.getElementById('app')
20 | );
21 |
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.1_Component_Lifecycle_Methods/4.1.2_Introduction_to_Lifecycle_Methods/Clock.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class Clock extends React.Component {
5 | // Add your methods in here.
6 | constructor(props) {
7 | super(props)
8 | this.state = { date: new Date() }
9 | }
10 |
11 | render() {
12 | return {this.state.date.toLocaleTimeString()}
13 | }
14 | }
15 |
16 | ReactDOM.render( , document.getElementById('app'));
17 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.5_Fetch_Data/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: center;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | position: relative;
15 | height: 100%;
16 | width: 100%;
17 | padding: 8px;
18 | }
19 |
20 | table {
21 | width: 100%;
22 | text-align: center;
23 | }
24 |
25 | th {
26 | text-decoration: underline;
27 | }
28 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.6_Share_Styles_Across_Multiple_Components/styles.js:
--------------------------------------------------------------------------------
1 | const fontFamily = 'Comic Sans MS, Lucida Handwriting, cursive';
2 | const background = 'pink url("https://content.codecademy.com/programs/react/images/welcome-to-my-homepage.gif") fixed';
3 | const fontSize = '4em';
4 | const padding = '45px 0';
5 | const color = 'green';
6 |
7 | export const styles = {
8 | fontFamily: fontFamily,
9 | background: background,
10 | fontSize: fontSize,
11 | padding: padding,
12 | color: color
13 | };
14 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.3_Review/Example.js:
--------------------------------------------------------------------------------
1 | // A component class written in the usual way:
2 | export class MyComponentClass extends React.Component {
3 | render() {
4 | return Hello world ;
5 | }
6 | }
7 |
8 | // The same component class, written as a stateless functional component:
9 | export const MyComponentClass = () => {
10 | return Hello world ;
11 | }
12 |
13 | // Works the same either way:
14 | ReactDOM.render(
15 | ,
16 | document.getElementById('app')
17 | );
18 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.4_Video_Player_Project/styles.css:
--------------------------------------------------------------------------------
1 | body {
2 | background: #ffffff;
3 | text-align: center;
4 | font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
5 | font-weight: 300;
6 | }
7 |
8 | input {
9 | padding: 5px;
10 | font-size: 16px;
11 | }
12 |
13 | input:not(:first-of-type) {
14 | margin-left: 20px;
15 | }
16 |
17 | video {
18 | margin: 30px;
19 | width: 500px;
20 | max-width: 85%;
21 | }
22 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.6_Review/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.12_defaultProps/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../Button'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it('', function () {
8 | let wrapper = shallow( );
9 | expect(
10 | wrapper.text(),
11 | "`Button.defaultProps` should equal `{ text: 'I am a button' }`"
12 | ).to.contain('I am a button');
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.5_Automatic_Binding/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.2_Create_Container_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.6_Copycat_Project/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | max-height: 100%;
9 | }
10 |
11 | code {
12 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
13 | monospace;
14 | }
15 |
16 | img {
17 | width: 40%;
18 | }
19 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.6_Arrays_in_State/ItemList.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export default function ItemList({ items, onItemClick }) {
4 |
5 | const handleClick = ({ target }) => {
6 | const item = target.value;
7 | onItemClick(item);
8 | };
9 | return (
10 |
11 | {items.map((item, index) => (
12 |
13 | {item}
14 |
15 | ))}
16 |
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.2_Define_an_Event_Handler/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.3_Pass_the_Event_Handler/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.4_Receive_the_Event_Handler/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.2_Setting_Initial_State/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class App extends React.Component {
5 | // constructor method begins here:
6 | constructor(props) {
7 | super(props);
8 | this.state = { title: 'Best App' };
9 | }
10 |
11 | render() {
12 | return (
13 |
14 | {this.state.title}
15 |
16 | );
17 | }
18 | }
19 |
20 | ReactDOM.render( , document.getElementById('app'))
21 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.2_Setting_Initial_State/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../App'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it('', function () {
8 | let wrapper = shallow( );
9 | expect(
10 | wrapper.state().title,
11 | '`App` should return `{this.state.title} `'
12 | ).to.equal(wrapper.find('h1').text());
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.1_Stateless_Functional_Components/Example.js:
--------------------------------------------------------------------------------
1 | // A component class written in the usual way:
2 | export class MyComponentClass extends React.Component {
3 | render() {
4 | return Hello world ;
5 | }
6 | }
7 |
8 | // The same component class, written as a stateless functional component:
9 | export const MyComponentClass = () => {
10 | return Hello world ;
11 | }
12 |
13 | // Works the same either way:
14 | ReactDOM.render(
15 | ,
16 | document.getElementById('app')
17 | );
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.2_Function_Components_and_Props/Example.js:
--------------------------------------------------------------------------------
1 | // A component class written in the usual way:
2 | export class MyComponentClass extends React.Component {
3 | render() {
4 | return Hello world ;
5 | }
6 | }
7 |
8 | // The same component class, written as a stateless functional component:
9 | export const MyComponentClass = () => {
10 | return Hello world ;
11 | }
12 |
13 | // Works the same either way:
14 | ReactDOM.render(
15 | ,
16 | document.getElementById('app')
17 | );
18 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.4_Pass_a_Component_s_State/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.2_One_Sibling_to_Display,_Another_to_Change/Sibling.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Sibling extends React.Component {
4 | render() {
5 |
6 | return (
7 |
8 |
Hey, my name is Frarthur!
9 | Don't you think Frarthur is the prettiest name ever?
10 | Sure am glad that my parents picked Frarthur!
11 |
12 | );
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.3_Pass_the_Right_props_to_the_Right_Siblings/Sibling.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Sibling extends React.Component {
4 | render() {
5 |
6 | return (
7 |
8 |
Hey, my name is Frarthur!
9 | Don't you think Frarthur is the prettiest name ever?
10 | Sure am glad that my parents picked Frarthur!
11 |
12 | );
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.10_JSX_Conditionals_If_Statements_That_Do_Work/if.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | let message;
5 |
6 | if (user.age >= drinkingAge) {
7 | message = (
8 |
9 | Hey, check out this alcoholic beverage!
10 |
11 | );
12 | } else {
13 | message = (
14 |
15 | Hey, check out these earrings I got at Claire's!
16 |
17 | );
18 | }
19 |
20 | ReactDOM.render(
21 | message,
22 | document.getElementById('app')
23 | );
24 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.3_Access_a_Component_s_state/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class App extends React.Component {
5 | // constructor method begins here:
6 | constructor(props) {
7 | super(props);
8 | this.state = { title: 'Best App' };
9 | }
10 |
11 | render() {
12 | return (
13 |
14 | {this.state.title}
15 |
16 | );
17 | }
18 | }
19 |
20 | ReactDOM.render( , document.getElementById('app'))
21 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.3_Access_a_Component_s_state/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../App'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it('', function () {
8 | let wrapper = shallow( );
9 | expect(
10 | wrapper.state().title,
11 | '`App` should return `{this.state.title} `'
12 | ).to.equal(wrapper.find('h1').text());
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.2_Build_a_Stateful_Component_Class/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.3_Build_a_Stateless_Component_Class/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.3_Separate_Presentational_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.4_Use_a_Conditional_in_a_Render_Function/TodaysPlan.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class TodaysPlan extends React.Component {
5 | render() {
6 | let task;
7 | if (!apocalypse) {
8 | task = 'learn React.js'
9 | } else {
10 | task = 'run around'
11 | }
12 |
13 | return Today I am going to {task}! ;
14 | }
15 | }
16 |
17 | ReactDOM.render(
18 | ,
19 | document.getElementById('app')
20 | );
21 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.4_Pass_a_Component_s_State/Parent.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import { Child } from "./Child";
3 |
4 | class Parent extends Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = {
8 | name: "Frarthur"
9 | };
10 | }
11 |
12 | render() {
13 | return ;
14 | }
15 | }
16 |
17 | ReactDOM.render(
18 | ,
19 | document.getElementById("app")
20 | );
21 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.2_One_Sibling_to_Display,_Another_to_Change/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.3_Pass_the_Right_props_to_the_Right_Siblings/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.4_Display_Information_in_a_Sibling_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.5_Remove_Logic_from_Presentational_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.2_Input_onChange/Input.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | export class Input extends React.Component {
5 | render() {
6 | return (
7 |
8 |
12 |
I am an h1.
13 |
14 | );
15 | }
16 | }
17 |
18 | ReactDOM.render(
19 | ,
20 | document.getElementById('app')
21 | );
22 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.1_Separate_Container_Components_From_Presentational_Components/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.1_Components_Render_Other_Components/AnteaterProfile.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 |
3 | var AnteaterProfile = React.createClass({
4 | render: function () {
5 | return (
6 |
7 |
Annie the Anteater
8 |
9 |
10 | "I don't just eat ants, ants are more like a lifestyle for me." - Annie
11 |
12 |
13 | );
14 | }
15 | });
16 |
17 | module.exports = AnteaterProfile;
18 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.2_Container_Components_From_Presentational_Components/7.2.4_Render_Presentational_Component_in_Container_Component/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.4_Display_Information_in_a_Sibling_Component/Sibling.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Sibling extends React.Component {
4 | render() {
5 | const name = this.props.name;
6 | return (
7 |
8 |
Hey, my name is {name}!
9 | Don't you think {name} is the prettiest name ever?
10 | Sure am glad that my parents picked {name}!
11 |
12 | );
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.5_Stateless_Components_Inherit_From_Stateful_Components_Recap/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Learn ReactJS
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.02_Access_a_Component_s_props/PropsDisplayer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class PropsDisplayer extends React.Component {
5 | render() {
6 | const stringProps = JSON.stringify(this.props);
7 |
8 | return (
9 |
10 |
CHECK OUT MY PROPS OBJECT
11 | {stringProps}
12 |
13 | );
14 | }
15 | }
16 |
17 | // ReactDOM.render goes here:
18 | ReactDOM.render( , document.getElementById('app'))
19 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.07_Put_an_Event_Handler_in_a_Component_Class/Talker.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Button } from './Button';
4 |
5 |
6 |
7 | class Talker extends React.Component {
8 | talk() {
9 | let speech = '';
10 | for (let i = 0; i < 10000; i++) {
11 | speech += 'blah ';
12 | }
13 | alert(speech);
14 | }
15 |
16 | render() {
17 | return ;
18 | }
19 | }
20 |
21 | ReactDOM.render(
22 | ,
23 | document.getElementById('app')
24 | );
25 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.5_Stateless_Components_Inherit_From_Stateful_Components_Recap/Sibling.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Sibling extends React.Component {
4 | render() {
5 | const name = this.props.name;
6 | return (
7 |
8 |
Hey, my name is {name}!
9 | Don't you think {name} is the prettiest name ever?
10 | Sure am glad that my parents picked {name}!
11 |
12 | );
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.03_Pass_props_to_a_Component/PropsDisplayer.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class PropsDisplayer extends React.Component {
5 | render() {
6 | const stringProps = JSON.stringify(this.props);
7 |
8 | return (
9 |
10 |
CHECK OUT MY PROPS OBJECT
11 | {stringProps}
12 |
13 | );
14 | }
15 | }
16 |
17 | // ReactDOM.render goes here:
18 | ReactDOM.render( , document.getElementById('app'))
19 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.08_Pass_an_Event_Handler_as_a_prop/Talker.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Button } from './Button';
4 |
5 | class Talker extends React.Component {
6 | handleClick() {
7 | let speech = '';
8 | for (let i = 0; i < 10000; i++) {
9 | speech += 'blah ';
10 | }
11 | alert(speech);
12 | }
13 |
14 | render() {
15 | return ;
16 | }
17 | }
18 |
19 | ReactDOM.render(
20 | ,
21 | document.getElementById('app')
22 | );
23 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.8_Lesson_Review/PageTitleFunction.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 |
3 | export default function PageTitle() {
4 | const [name, setName] = useState('');
5 |
6 | useEffect(() => {
7 | document.title = `Hi, ${name}`;
8 | }, [name]);
9 |
10 | return (
11 |
12 |
Use {name} input field below to rename this page!
13 |
setName(target.value)}
15 | value={name}
16 | type='text' />
17 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.09_Receive_an_Event_Handler_as_a_prop/Talker.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Button } from './Button';
4 |
5 | class Talker extends React.Component {
6 | handleClick() {
7 | let speech = '';
8 | for (let i = 0; i < 10000; i++) {
9 | speech += 'blah ';
10 | }
11 | alert(speech);
12 | }
13 |
14 | render() {
15 | return ;
16 | }
17 | }
18 |
19 | ReactDOM.render(
20 | ,
21 | document.getElementById('app')
22 | );
23 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.1_Why_Use_useEffect/PageTitleFunction.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 |
3 | export default function PageTitle() {
4 | const [name, setName] = useState('');
5 |
6 | useEffect(() => {
7 | document.title = `Hi, ${name}`;
8 | }, [name]);
9 |
10 | return (
11 |
12 |
Use {name} input field below to rename this page!
13 |
setName(target.value)}
15 | value={name}
16 | type='text' />
17 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.10_handleEvent_onEvent_and_this.props.onEvent/Talker.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Button } from './Button';
4 |
5 | class Talker extends React.Component {
6 | handleClick() {
7 | let speech = '';
8 | for (let i = 0; i < 10000; i++) {
9 | speech += 'blah ';
10 | }
11 | alert(speech);
12 | }
13 |
14 | render() {
15 | return ;
16 | }
17 | }
18 |
19 | ReactDOM.render(
20 | ,
21 | document.getElementById('app')
22 | );
23 |
--------------------------------------------------------------------------------
/5_Hooks/5.1_Function_Components/5.1.3_Review/Friend.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // as function component
5 | export const Friend = () => {
6 | return ;
7 | }
8 |
9 | // as class component
10 | // export class Friend extends React.Component {
11 | // render() {
12 | // return ;
13 | // }
14 | // }
15 |
16 | ReactDOM.render(
17 | ,
18 | document.getElementById('app')
19 | );
20 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.2_Function_Component_Effects/Counter.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 |
3 | export default function Counter() {
4 | const [count, setCount] = useState(0);
5 |
6 | useEffect(() => {
7 | alert(`Count: ${count}`);
8 | });
9 |
10 | const handleClick = () => {
11 | setCount((prevCount) => prevCount + 1);
12 | };
13 |
14 | return (
15 |
16 |
You clicked {count} times
17 |
18 | Click me
19 |
20 |
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.06_Render_Different_UI_Based_on_props/Welcome.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Welcome extends React.Component {
4 | render() {
5 | if (this.props.name === 'Wolfgang Amadeus Mozart') {
6 | return (
7 |
8 | hello sir it is truly great to meet you here on the web
9 |
10 | );
11 | } else {
12 | return (
13 |
14 | WELCOME "2" MY WEB SITE BABYYY!!!!!
15 |
16 | );
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.1_Why_Use_Hooks/Presentational/TasksList.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export default function TasksList({ allTasks, handleDelete }) {
4 | return (
5 |
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.9_Lesson_Review/Presentational/TasksList.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export default function TasksList({ allTasks, handleDelete }) {
4 | return (
5 |
16 | );
17 | }
18 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.6_Rules_of_Hooks/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: center;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | position: relative;
15 | height: 100%;
16 | width: 100%;
17 | padding: 8px;
18 | }
19 |
20 |
21 | h1 {
22 | margin: 8px 0;
23 | }
24 |
25 | ul {
26 | list-style: none;
27 | text-align: center;
28 | }
29 |
30 | ul {
31 | padding: 0;
32 | }
33 |
34 | li {
35 | border-radius: 5px 2px;
36 | margin: 8px 0;
37 | }
38 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.2_Input_onChange/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Example extends React.Component {
4 | constructor(props) {
5 | super(props);
6 |
7 | this.state = { userInput: '' };
8 |
9 | this.handleChange = this.handleChange.bind(this);
10 | }
11 |
12 | handleChange(e) {
13 | this.setState({
14 | userInput: e.target.value
15 | });
16 | }
17 |
18 | render() {
19 | return (
20 |
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.11_JSX_Conditionals_The_Ternary_Operator/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | function coinToss() {
5 | // Randomly return either 'heads' or 'tails'.
6 | return Math.random() < 0.5 ? 'heads' : 'tails';
7 | }
8 |
9 | const pics = {
10 | kitty: 'https://content.codecademy.com/courses/React/react_photo-kitty.jpg',
11 | doggy: 'https://content.codecademy.com/courses/React/react_photo-puppy.jpeg'
12 | };
13 |
14 | const img = ;
15 |
16 | ReactDOM.render(
17 | img,
18 | document.getElementById('app')
19 | );
20 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.4_Use_a_Conditional_in_a_Render_Function/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const fiftyFifty = Math.random() < 0.5;
5 |
6 | // New component class starts here:
7 | class TonightsPlan extends React.Component {
8 | render() {
9 | let task;
10 | if (fiftyFifty) {
11 | task = 'out WOOO';
12 | } else {
13 | task = 'to bed WOOO';
14 | }
15 | return Tonight I'm going {task} ;
16 | }
17 | }
18 |
19 | ReactDOM.render(
20 | ,
21 | document.getElementById('app')
22 | );
23 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.06_Render_Different_UI_Based_on_props/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Greeting } from './Greeting';
4 |
5 | class App extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 | Hullo and, "Welcome to The Newzz," "On Line!"
11 |
12 |
13 |
14 | Latest: where is my phone?
15 |
16 |
17 | );
18 | }
19 | }
20 |
21 | ReactDOM.render(
22 | ,
23 | document.getElementById('app')
24 | );
25 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.1_Child_Components_Update_Their_Parents_state/Step3.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | export class ChildClass extends React.Component {
5 | render() {
6 | return (
7 | // The stateless component class uses
8 | // the passed-down handleClick function,
9 | // accessed here as this.props.onClick,
10 | // as an event handler:
11 |
12 | Click Me!
13 |
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.6_Share_Styles_Across_Multiple_Components/FacebookColorThief.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { colorStyles } from './facebookStyles';
4 |
5 | let divStyle = {
6 | backgroundColor: styles.darkBlue,
7 | color: styles.white
8 | };
9 |
10 | export class Wow extends React.Component {
11 | render() {
12 | return (
13 |
14 | Wow, I stole these colors from Facebook!
15 |
16 | );
17 | }
18 | }
19 |
20 | ReactDOM.render(
21 | ,
22 | document.getElementById('app')
23 | );
24 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.5_Update_an_Input_s_Value/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Example extends React.Component {
4 | constructor(props) {
5 | super(props);
6 |
7 | this.state = { userInput: '' };
8 |
9 | this.handleChange = this.handleChange.bind(this);
10 | }
11 |
12 | handleChange(e) {
13 | this.setState({
14 | userInput: e.target.value
15 | });
16 | }
17 |
18 | render() {
19 | return (
20 |
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.12_JSX_Conditionals_And/favorite-foods.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | // judgmental will be true half the time.
5 | const judgmental = Math.random() < 0.5;
6 |
7 | const favoriteFoods = (
8 |
9 |
My Favorite Foods
10 |
11 | Sushi Burrito
12 | Rhubarb Pie
13 | { !judgmental && Nacho Cheez Straight Out The Jar }
14 | Broiled Grapefruit
15 |
16 |
17 | );
18 |
19 | ReactDOM.render(
20 | favoriteFoods,
21 | document.getElementById('app')
22 | );
23 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.3_Clean_Up_Effects/Counter.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react';
2 |
3 | export default function Counter() {
4 | const [clickCount, setClickCount] = useState(0);
5 |
6 | // your code here
7 | useEffect(() => {
8 | document.addEventListener('mousedown', increment);
9 | return () => {
10 | document.removeEventListener('mousedown', increment);
11 | };
12 | });
13 |
14 | const increment = () => {
15 | setClickCount((prevClickCount) => prevClickCount + 1);
16 | };
17 |
18 | return (
19 | Document Clicks: {clickCount}
20 | );
21 | }
22 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.3_Write_an_Input_Event_Handler/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Example extends React.Component {
4 | constructor(props) {
5 | super(props);
6 |
7 | this.state = { userInput: '' };
8 |
9 | this.handleChange = this.handleChange.bind(this);
10 | }
11 |
12 | handleChange(e) {
13 | this.setState({
14 | userInput: e.target.value
15 | });
16 | }
17 |
18 | render() {
19 | return (
20 |
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.4_Set_the_Input_s_Initial_State/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Example extends React.Component {
4 | constructor(props) {
5 | super(props);
6 |
7 | this.state = { userInput: '' };
8 |
9 | this.handleChange = this.handleChange.bind(this);
10 | }
11 |
12 | handleChange(e) {
13 | this.setState({
14 | userInput: e.target.value
15 | });
16 | }
17 |
18 | render() {
19 | return (
20 |
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.6_Controlled_vs_Uncontrolled/Example.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Example extends React.Component {
4 | constructor(props) {
5 | super(props);
6 |
7 | this.state = { userInput: '' };
8 |
9 | this.handleChange = this.handleChange.bind(this);
10 | }
11 |
12 | handleChange(e) {
13 | this.setState({
14 | userInput: e.target.value
15 | });
16 | }
17 |
18 | render() {
19 | return (
20 |
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.1_Components_Render_Other_Components/ProfilePage.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { NavBar } from './NavBar.js';
4 |
5 | class ProfilePage extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 |
All About Me!
11 |
I like movies and blah blah blah blah blah
12 |
13 |
14 | );
15 | }
16 | }
17 |
18 | ReactDOM.render( , document.getElementById('app'))
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.4_Pass_a_Component_s_State/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../Child'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it('', function () {
8 | let wrapper = shallow( );
9 | expect(
10 | wrapper.html(),
11 | '`` should return `Hey, my name is {this.props.name}! `.'
12 | ).to.match(/< *h1 *>Hey,? +my +name +is +deg[\!\.]?< *\/ *h1 *>/);
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.1_Component_Lifecycle_Methods/4.1.4_componentWillUnmount/Clock.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Clock extends React.Component {
4 | constructor(props) {
5 | super(props);
6 | this.state = { date: new Date() };
7 | }
8 | render() {
9 | return {this.state.date.toLocaleTimeString()}
;
10 | }
11 | componentDidMount() {
12 | const oneSecond = 1000;
13 | this.intervalID = setInterval(() => {
14 | this.setState({ date: new Date() });
15 | }, oneSecond);
16 | }
17 |
18 | componentWillUnmount() {
19 | clearInterval(this.intervalID);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.08_Event_Listeners_in_JSX/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | function makeDoggy(e) {
5 | // Call this extremely useful function on an .
6 | // The will become a picture of a doggy.
7 | e.target.setAttribute('src', 'https://content.codecademy.com/courses/React/react_photo-puppy.jpeg');
8 | e.target.setAttribute('alt', 'doggy');
9 | }
10 |
11 | const kitty = (
12 |
17 | );
18 |
19 | ReactDOM.render(kitty, document.getElementById('app'));
20 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.1_Why_Use_Hooks/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.8_Lesson_Review/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.1_Child_Components_Update_Their_Parents_state/Step1.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { ChildClass } from './ChildClass';
4 |
5 | class ParentClass extends React.Component {
6 | constructor(props) {
7 | super(props);
8 |
9 | this.state = { totalClicks: 0 };
10 | }
11 |
12 | handleClick() {
13 | const total = this.state.totalClicks;
14 |
15 | // calling handleClick will
16 | // result in a state change:
17 | this.setState(
18 | { totalClicks: total + 1 }
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.1_propTypes/BestSeller.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 |
5 | export class BestSeller extends React.Component {
6 | render() {
7 | return (
8 |
9 | Title:
10 | {this.props.title}
11 |
12 |
13 | Author:
14 | {this.props.author}
15 |
16 |
17 | Weeks:
18 | {this.props.weeksOnList}
19 |
20 |
21 | );
22 | }
23 | }
24 |
25 | BestSeller.propTypes = {};
26 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.2_Apply_PropTypes/BestSeller.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | export class BestSeller extends React.Component {
5 | render() {
6 | return (
7 |
8 | Title:
9 | {this.props.title}
10 |
11 |
12 | Author:
13 | {this.props.author}
14 |
15 |
16 | Weeks:
17 | {this.props.weeksOnList}
18 |
19 |
20 | );
21 | }
22 | }
23 |
24 | BestSeller.propTypes = {};
25 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.2_Use_a_Variable_Attribute_in_a_Component/app.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 |
4 |
5 | const owl = {
6 | title: 'Excellent Owl',
7 | src: 'https://content.codecademy.com/courses/React/react_photo-owl.jpg'
8 | };
9 |
10 | // Component class starts here:
11 | class Owl extends React.Component {
12 | render() {
13 | return (
14 |
15 |
{owl.title}
16 |
17 |
18 | );
19 | }
20 | }
21 |
22 | ReactDOM.render(
23 | ,
24 | document.getElementById('app')
25 | );
26 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.09_Receive_an_Event_Handler_as_a_prop/test/test.js:
--------------------------------------------------------------------------------
1 | let mount = require('enzyme/mount'),
2 | appModule = require('../Talker'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("", function () {
8 | const wrapper = mount( );
9 | expect(wrapper.instance().handleClick, 'Rename the `talk` function to `handleClick`.').to.be.a('function');
10 |
11 | expect(wrapper.find('button').props().onClick, "In Button.js, ``'s `onClick` attribute should be `{this.props.onClick}`.").to.eql(wrapper.instance().handleClick);
12 | });
13 | });
14 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.6_Arrays_in_State/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.3_Clean_Up_Effects/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.6_Rules_of_Hooks/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.5_Set_From_Previous_State/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.2_Define_an_Event_Handler/Parent.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Child } from './Child';
4 |
5 | class Parent extends React.Component {
6 | constructor(props) {
7 | super(props);
8 |
9 | this.state = { name: 'Frarthur' };
10 | }
11 |
12 | changeName(newName) {
13 | this.setState({
14 | name: newName
15 | });
16 | }
17 |
18 | render() {
19 | return
20 | }
21 | }
22 |
23 | ReactDOM.render(
24 | ,
25 | document.getElementById('app')
26 | );
27 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.10_handleEvent_onEvent_and_this.props.onEvent/test/test.js:
--------------------------------------------------------------------------------
1 | let mount = require('enzyme/mount'),
2 | appModule = require('../Talker'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("", function () {
8 | const wrapper = mount( );
9 | expect(wrapper.instance().handleClick, 'Rename the `talk` function to `handleClick`.').to.be.a('function');
10 |
11 | expect(wrapper.find('button').props().onClick, "In Button.js, ``'s `onClick` attribute should be `{this.props.onClick}`.").to.eql(wrapper.instance().handleClick);
12 | });
13 | });
14 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.2_Function_Component_Effects/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.6_Rules_of_Hooks/mockBackend/data.js:
--------------------------------------------------------------------------------
1 | // You don't need to look at this, but you can if you want!
2 |
3 | /*
4 | When building user interfaces, it can be helpful to
5 | mock out simplified versions of the data that our code
6 | will eventually fetch from backend servers
7 | */
8 |
9 | export default {
10 | "/categories": ["Shirts", "Pants", "Shoes", "Accessories"],
11 | "/items?category=Shirts": ["T-Shirts", "Casual", "Formal"],
12 | "/items?category=Pants": ["Long Pants", "Sweat Pants", "Shorts", "Swimwear"],
13 | "/items?category=Shoes": ["Athletic", "Professional", "Casual", "Walking"],
14 | "/items?category=Accessories": ["Hats", "Wallets", "Belts"]
15 | };
16 |
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.1_Component_Lifecycle_Methods/4.1.3_componentDidMount/Clock.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class Clock extends React.Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = { date: new Date() };
8 | }
9 |
10 | render() {
11 | return {this.state.date.toLocaleTimeString()}
;
12 | }
13 |
14 | componentDidMount() {
15 | // Paste your code here.
16 | const oneSecond = 1000;
17 | setInterval(() => {
18 | this.setState({ date: new Date() });
19 | }, oneSecond);
20 | }
21 | }
22 |
23 | ReactDOM.render( , document.getElementById('app'));
24 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.2_Update_Function_Component_State/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.8_Separate_Hooks_for_Separate_States/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.4_Control_When_Effects_Are_Called/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.2_Build_a_Stateful_Component_Class/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../Child'),
3 | components = appModule.__ReactComponents;
4 |
5 | describe('', function () {
6 | it('', function () {
7 | const TestedComponent = Array.isArray(components) ? components[0] : null;
8 | expect(TestedComponent, 'Did you declare a `` component?').to.be.ok;
9 |
10 | let wrapper = shallow( );
11 | expect(wrapper.html(), '`` should return ` `.').to.equal(
12 | ' '
13 | );
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.1_Components_Render_Other_Components/MainPage.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 | var ReactDOM = require('react-dom');
3 | var AnteaterProfile = require('./AnteaterProfile');
4 |
5 | var MainPage = React.createClass({
6 | render: function () {
7 | return (
8 |
9 |
Welcome to Anteater Towne!!!
10 |
11 |
12 | To view more anteater profiles just like this one, sign up for an account!
13 |
14 |
15 | );
16 | }
17 | });
18 |
19 | ReactDOM.render(
20 | ,
21 | document.getElementById('app')
22 | );
23 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.7_Separate_Hooks_for_Separate_Effects/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../app'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it("The should have an onClick attribute.", function () {
8 | let wrapper = shallow( );
9 | expect('onClick' in wrapper.props()).to.equal(true);
10 | });
11 | it("onClick should be equal to {this.scream}", function () {
12 | let wrapper = shallow( );
13 | expect(wrapper.props().onClick).to.eql(wrapper.instance().scream);
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.1_Stateless_Components_From_Stateful_Components/6.1.3_Build_a_Stateless_Component_Class/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../Child'),
3 | components = appModule.__ReactComponents;
4 |
5 | describe('', function () {
6 | it('', function () {
7 | const TestedComponent = Array.isArray(components) ? components[0] : null;
8 | expect(TestedComponent, 'Did you declare a `` component?').to.be.ok;
9 |
10 | let wrapper = shallow( );
11 | expect(wrapper.html(), '`` should return ` `.').to.equal(
12 | ' '
13 | );
14 | });
15 | });
16 |
--------------------------------------------------------------------------------
/1_JSX/1.3_Animal_Fun_Facts_Project/animals.js:
--------------------------------------------------------------------------------
1 | export const animals = {
2 | dolphin: {
3 | image: '/images/dolphin.jpg',
4 | facts: ['Dolphins have been shown to give distinct names to each other!', 'Dolphins are known to display their own culture!', 'Dolphins have two stomachs!']
5 | },
6 | lobster: {
7 | image: '/images/lobster.jpg',
8 | facts: ['Lobsters taste with their legs!', 'Lobsters chew with their stomachs!', 'Lobsters can live as long as 100 years.']
9 | },
10 | starfish: {
11 | image: '/images/starfish.jpg',
12 | facts: ['Starfish can have up to 40 arms!', 'Starfish have no brain and no blood!', 'Starfish can regenerate their own arms!']
13 | }
14 | };
15 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.11_this.props.children/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { List } from './List';
4 |
5 | class App extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 | Sachiko M
11 | Harvey Sid Fisher
12 |
13 |
14 | Nora the Piano Cat
15 |
16 |
17 | );
18 | }
19 | }
20 |
21 | ReactDOM.render(
22 | ,
23 | document.getElementById('app')
24 | );
25 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.3_Child_Components_Update_Their_Siblings_props/6.3.4_Display_Information_in_a_Sibling_Component/test/test.js:
--------------------------------------------------------------------------------
1 | let mount = require('enzyme/mount'),
2 | appModule = require('../Parent'),
3 | Child = require('../Child').Child,
4 | Sibling = require('../Sibling').Sibling,
5 | components = appModule.__ReactComponents,
6 | TestedComponent = components[0];
7 |
8 | describe('', function () {
9 | it('', function () {
10 | let wrapper = mount( );
11 | expect(
12 | wrapper.find(Child).props().name,
13 | 'In **Parent.js**, ` ` should not have a `name` attribute.'
14 | ).to.not.exist;
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.3_Write_an_Input_Event_Handler/Input.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | export class Input extends React.Component {
5 | handleUserInput(e) {
6 | this.setState({
7 | userInput: e.target.value
8 | });
9 | }
10 |
11 | render() {
12 | return (
13 |
14 |
18 |
I am an h1.
19 |
20 | );
21 | }
22 | }
23 |
24 | ReactDOM.render(
25 | ,
26 | document.getElementById('app')
27 | );
28 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.05_Pass_props_From_Component_To_Component/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Greeting } from './Greeting.js';
4 |
5 | class App extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 | Hullo and, "Welcome to The Newzz," "On Line!"
11 |
12 |
13 |
14 | Latest newzz: where is my phone?
15 |
16 |
17 | );
18 | }
19 | }
20 |
21 | ReactDOM.render(
22 | ,
23 | document.getElementById('app')
24 | );
25 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.1_Style/7.1.6_Share_Styles_Across_Multiple_Components/Hume.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { AttentionGrabber } from './AttentionGrabber';
4 | import { styles } from './styles';
5 |
6 | const divStyle = {
7 | background: styles.background,
8 | height: '100%',
9 | }
10 |
11 | export class Home extends React.Component {
12 | render() {
13 | return (
14 |
15 |
16 |
THANK YOU FOR VISITING MY HOMEPAGE!
17 |
18 | );
19 | }
20 | }
21 |
22 | ReactDOM.render(
23 | ,
24 | document.getElementById('app')
25 | );
26 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.10_JSX_Conditionals_If_Statements_That_Do_Work/app.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | function coinToss() {
5 | // This function will randomly return either 'heads' or 'tails'.
6 | return Math.random() < 0.5 ? 'heads' : 'tails';
7 | }
8 |
9 | const pics = {
10 | kitty: 'https://content.codecademy.com/courses/React/react_photo-kitty.jpg',
11 | doggy: 'https://content.codecademy.com/courses/React/react_photo-puppy.jpeg'
12 | };
13 | let img;
14 |
15 | // if/else statement begins here:
16 | if (coinToss() === 'heads') {
17 | img = ;
18 | } else {
19 | img = ;
20 | }
21 |
22 | ReactDOM.render(img, document.getElementById('app'));
23 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.4_Control_When_Effects_Are_Called/Timer.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react';
2 |
3 | export default function Timer() {
4 | const [time, setTime] = useState(0);
5 | const [name, setName] = useState('');
6 |
7 | useEffect(() => {
8 | const intervalId = setInterval(() => {
9 | setTime((prevTime) => prevTime + 1);
10 | }, 1000);
11 | return () => {
12 | clearInterval(intervalId);
13 | };
14 | }, []);
15 |
16 | const handleChange = ({ target }) => setName(target.value);
17 |
18 |
19 | return (
20 | <>
21 | Time: {time}
22 |
23 | >
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.06_Render_Different_UI_Based_on_props/test/test.js:
--------------------------------------------------------------------------------
1 | import { Greeting } from '../Greeting';
2 | let shallow = require('enzyme/shallow'),
3 | appModule = require('../App'),
4 | components = appModule.__ReactComponents,
5 | TestedComponent = components[0];
6 |
7 | describe('', function () {
8 | it('', function () {
9 | let wrapper = shallow( );
10 |
11 | // We want to check that this is `false` but then the final checkpoint
12 | // won't pass, so we just make sure it's a boolean.
13 | expect(
14 | wrapper.find(Greeting).props().signedIn,
15 | '` ` should have a `signedIn={false}` attribute.'
16 | ).to.be.a('boolean');
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.5_Automatic_Binding/Parent.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Child } from './Child';
4 |
5 | class Parent extends React.Component {
6 | constructor(props) {
7 | super(props);
8 |
9 | this.state = { name: 'Frarthur' };
10 | this.changeName = this.changeName.bind(this);
11 | }
12 |
13 | changeName(newName) {
14 | this.setState({
15 | name: newName
16 | });
17 | }
18 |
19 | render() {
20 | return
21 | }
22 | }
23 |
24 | ReactDOM.render(
25 | ,
26 | document.getElementById('app')
27 | );
28 |
--------------------------------------------------------------------------------
/1_JSX/1.2_Advanced_JSX/1.2.15_React.createElement/app.compiled.js:
--------------------------------------------------------------------------------
1 | (function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { if (!e[i]) { var c = "function" == typeof require && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error("Cannot find module '" + i + "'"); throw a.code = "MODULE_NOT_FOUND", a } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) } return n[i].exports } for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)o(t[i]); return o } return r })()({
2 | 1: [function (require, module, exports) {
3 | "use strict";
4 |
5 | var greatestDivEver = React.createElement("div", null, "i am div");
6 |
7 | }, {}]
8 | }, {}, [1]);
9 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.3_Pass_the_Event_Handler/Parent.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Child } from './Child';
4 |
5 | class Parent extends React.Component {
6 | constructor(props) {
7 | super(props);
8 |
9 | this.state = { name: 'Frarthur' };
10 | this.changeName = this.changeName.bind(this);
11 | }
12 |
13 | changeName(newName) {
14 | this.setState({
15 | name: newName
16 | });
17 | }
18 |
19 | render() {
20 | return
21 | }
22 | }
23 |
24 | ReactDOM.render(
25 | ,
26 | document.getElementById('app')
27 | );
28 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.4_Receive_the_Event_Handler/Parent.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { Child } from './Child';
4 |
5 | class Parent extends React.Component {
6 | constructor(props) {
7 | super(props);
8 |
9 | this.state = { name: 'Frarthur' };
10 | this.changeName = this.changeName.bind(this);
11 | }
12 |
13 | changeName(newName) {
14 | this.setState({
15 | name: newName
16 | });
17 | }
18 |
19 | render() {
20 | return
21 | }
22 | }
23 |
24 | ReactDOM.render(
25 | ,
26 | document.getElementById('app')
27 | );
28 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.05_Pass_props_From_Component_To_Component/MainPage.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { StewDescriber } from './StewDescriber';
4 |
5 | class MainPage extends React.Component {
6 | render() {
7 | return (
8 |
9 |
WELCOME 2 MY SITE WHERE I DESCRIBE THINGS!!
10 | Today I will be describing stews! Tomorrow, who knows! Life is a journey
11 |
12 | Don't forget to clap back in the comments
13 |
14 | );
15 | }
16 | }
17 |
18 | ReactDOM.render(
19 | ,
20 | document.getElementById('app')
21 | );
22 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.1_Use_Multiline_JSX_in_a_Component/app.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import QuoteMaker from "./QuoteMaker";
4 |
5 | class App extends React.Component {
6 | render() {
7 | return (
8 |
9 |
10 | What is important now is to recover our senses.
11 |
12 |
13 |
15 | Susan Sontag
16 |
17 |
18 |
19 | );
20 | }
21 | }
22 |
23 | ReactDOM.render( , document.getElementById("app"));
24 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.2_Use_a_Variable_Attribute_in_a_Component/RedPanda.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const redPanda = {
5 | src: 'https://upload.wikimedia.org/wikipedia/commons/b/b2/Endangered_Red_Panda.jpg',
6 | alt: 'Red Panda',
7 | width: '200px'
8 | };
9 |
10 | class RedPanda extends React.Component {
11 | render() {
12 | return (
13 |
14 |
Cute Red Panda
15 |
19 |
20 | );
21 | }
22 | }
23 |
24 | ReactDOM.render(
25 | ,
26 | document.getElementById('app')
27 | );
28 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.6_Arrays_in_State/storeItems.js:
--------------------------------------------------------------------------------
1 | export const produce = [
2 | "Carrots",
3 | "Cucumbers",
4 | "Bell peppers",
5 | "Avocados",
6 | "Spinach",
7 | "Kale",
8 | "Tomatoes",
9 | "Bananas",
10 | "Lemons",
11 | "Ginger",
12 | "Onions",
13 | "Potatoes",
14 | "Sweet potatoes",
15 | "Purple cabbage",
16 | "Broccoli",
17 | "Mushrooms",
18 | "Cilantro"
19 | ];
20 |
21 | export const pantryItems = [
22 | "Chia",
23 | "Goji berries",
24 | "Peanut butter",
25 | "Bread",
26 | "Cashews",
27 | "Pumpkin seeds",
28 | "Peanuts",
29 | "Olive oil",
30 | "Sesame oil",
31 | "Tamari",
32 | "Pinto beans",
33 | "Black beans",
34 | "Coffee",
35 | "Rice",
36 | "Dates",
37 | "Quinoa"
38 | ];
39 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.2_this.props/3.2.05_Pass_props_From_Component_To_Component/test/test.js:
--------------------------------------------------------------------------------
1 | import { Greeting } from '../Greeting';
2 | let shallow = require('enzyme/shallow'),
3 | appModule = require('../App'),
4 | components = appModule.__ReactComponents,
5 | TestedComponent = components[0];
6 |
7 | describe('', function () {
8 | it('', function () {
9 | let wrapper = shallow( );
10 | expect(
11 | wrapper.find(Greeting),
12 | 'App should render a ` ` instance.'
13 | ).to.have.length(1);
14 | expect(
15 | wrapper.find(Greeting).props().name,
16 | '` ` should have a `name="xyz"` attribute, where `"xyz"` is a string value of your choice.'
17 | ).to.exist;
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.3_Initialize_State/ColorPicker.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 |
3 | const colorNames = ['Aquamarine', 'BlueViolet', 'Chartreuse', 'CornflowerBlue', 'Thistle', 'SpringGreen', 'SaddleBrown', 'PapayaWhip', 'MistyRose'];
4 |
5 | export default function ColorPicker() {
6 | const [color, setColor] = useState("Tomato");
7 |
8 | const divStyle = { backgroundColor: color };
9 |
10 | return (
11 |
12 |
Selected color: {color}
13 | {colorNames.map((colorName) => (
14 |
setColor(colorName)}
16 | key={colorName}>
17 | {colorName}
18 |
19 | ))}
20 |
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/4_Lifecycle_Methods/4.2_Social_Network_for_Pets_Project/Userlist.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Userlist extends React.Component {
4 | constructor(props) {
5 | super(props);
6 | this.handleClick = this.handleClick.bind(this);
7 | }
8 |
9 | handleClick(event) {
10 | this.props.onChoose(event.target.dataset.username);
11 | }
12 |
13 | render() {
14 | return (
15 |
16 | {this.props.usernames.map((username) => (
17 |
18 |
19 | @{username}
20 |
21 |
22 | ))}
23 |
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.4_PropTypes_in_Function_Components/Example.js:
--------------------------------------------------------------------------------
1 | // Normal way to display a prop:
2 | export class MyComponentClass extends React.Component {
3 | render() {
4 | return {this.props.title} ;
5 | }
6 | }
7 |
8 | // Functional component way to display a prop:
9 | export const MyComponentClass = (props) => {
10 | return {props.title} ;
11 | }
12 |
13 | // Normal way to display a prop using a variable:
14 | export class MyComponentClass extends React.component {
15 | render() {
16 | let title = this.props.title;
17 | return {title} ;
18 | }
19 | }
20 |
21 | // Functional component way to display a prop using a variable:
22 | export const MyComponentClass = (props) => {
23 | let title = props.title;
24 | return {title} ;
25 | }
26 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.4_PropTypes_in_Function_Components/test/test.js:
--------------------------------------------------------------------------------
1 | let TestedComponent = require('../components/GuineaPigs').GuineaPigs,
2 | React = require('react');
3 |
4 | describe('', function () {
5 | it('', function () {
6 | let pT = TestedComponent.propTypes;
7 |
8 | {
9 | const message =
10 | '`GuineaPigs` should have a property with a name of `propTypes` and a value of an object.';
11 | expect(pT, message).to.exist;
12 | expect(typeof pT, message).to.equal('object');
13 | }
14 |
15 | expect(
16 | pT && pT.src,
17 | "`GuineaPigs`'s `propTypes` object should have a property of `src: React.PropTypes.string.isRequired`."
18 | ).to.equal(React.PropTypes.string.isRequired);
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.4_Video_Player_Project/Menu.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Menu extends React.Component {
4 | constructor(props) {
5 | super(props);
6 | this.handleClick = this.handleClick.bind(this);
7 | }
8 |
9 | handleClick(e) {
10 | const text = e.target.value;
11 | this.props.chooseVideo(text);
12 | }
13 |
14 | render() {
15 | return (
16 |
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.3_PropTypes/7.3.3_Add_Properties_to_PropTypes/BestSeller.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import PropTypes from 'prop-types';
3 |
4 | export class BestSeller extends React.Component {
5 | render() {
6 | return (
7 |
8 | Title:
9 | {this.props.title}
10 |
11 |
12 | Author:
13 | {this.props.author}
14 |
15 |
16 | Weeks:
17 | {this.props.weeksOnList}
18 |
19 |
20 | );
21 | }
22 | }
23 |
24 | BestSeller.propTypes = {
25 | title: PropTypes.string.isRequired,
26 | author: PropTypes.string.isRequired,
27 | weeksOnList: PropTypes.number.isRequired
28 | };
29 |
--------------------------------------------------------------------------------
/2_React_Components/2.2_Components_and_Advanced_JSX/2.2.1_Use_Multiline_JSX_in_a_Component/QuoteMaker.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class QuoteMaker extends React.Component {
5 | render() {
6 | return (
7 |
8 |
9 | The world is full of objects, more or less interesting; I do not wish to add any more.
10 |
11 |
12 |
14 | Douglas Huebler
15 |
16 |
17 |
18 | );
19 | }
20 | };
21 |
22 | ReactDOM.render(
23 | ,
24 | document.getElementById('app')
25 | );
26 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.7_Objects_in_State/test/test.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs');
2 |
3 | describe('', function () {
4 | let moduleSourceCode;
5 | try {
6 | moduleSourceCode = fs.readFileSync('EditProfile.js', 'utf8');
7 | } catch (e) {
8 | expect(
9 | true,
10 | 'Try checking your code again. You likely have a syntax error.',
11 | ).to.equal(false);
12 | }
13 |
14 | it('', function () {
15 | function scaffoldedTest(msg, regex) {
16 | const passScaffoldedTest = regex.test(moduleSourceCode);
17 | expect(passScaffoldedTest, msg).to.be.true;
18 | }
19 |
20 | scaffoldedTest(
21 | 'Initialize `profile` as an empty object',
22 | /const \[profile, setProfile\] = useState\( ?{ ?} ?\);?/,
23 | );
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.2_Define_an_Event_Handler/Child.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Child extends React.Component {
4 | render() {
5 | return (
6 |
7 |
8 | Hey my name is {this.props.name}!
9 |
10 |
11 |
12 | Frarthur
13 |
14 |
15 |
16 | Gromulus
17 |
18 |
19 |
20 | Thinkpiece
21 |
22 |
23 |
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.3_Pass_the_Event_Handler/Child.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 |
3 | export class Child extends React.Component {
4 | render() {
5 | return (
6 |
7 |
8 | Hey my name is {this.props.name}!
9 |
10 |
11 |
12 | Frarthur
13 |
14 |
15 |
16 | Gromulus
17 |
18 |
19 |
20 | Thinkpiece
21 |
22 |
23 |
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.5_Call_this.setState_from_Another_Function/Mood.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class Mood extends React.Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = { mood: 'good' };
8 | this.toggleMood = this.toggleMood.bind(this);
9 | }
10 |
11 | toggleMood() {
12 | const newMood = this.state.mood == 'good' ? 'bad' : 'good';
13 | this.setState({ mood: newMood });
14 | }
15 |
16 | render() {
17 | return (
18 |
19 |
I'm feeling {this.state.mood}!
20 |
21 | Click Me
22 |
23 |
24 | );
25 | }
26 | }
27 |
28 | ReactDOM.render( , document.getElementById('app'));
29 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.6_this.setState_Automatically_Calls_render/Mood.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | class Mood extends React.Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = { mood: 'good' };
8 | this.toggleMood = this.toggleMood.bind(this);
9 | }
10 |
11 | toggleMood() {
12 | const newMood = this.state.mood == 'good' ? 'bad' : 'good';
13 | this.setState({ mood: newMood });
14 | }
15 |
16 | render() {
17 | return (
18 |
19 |
I'm feeling {this.state.mood}!
20 |
21 | Click Me
22 |
23 |
24 | );
25 | }
26 | }
27 |
28 | ReactDOM.render( , document.getElementById('app'));
29 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.8_Lesson_Review/PageTitleClass.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class PageTitle extends Component {
4 | constructor(props) {
5 | super(props);
6 | this.state = {
7 | name: ''
8 | };
9 | }
10 |
11 | componentDidMount() {
12 | document.title = this.state.name;
13 | }
14 |
15 | componentDidUpdate() {
16 | document.title == `Hi, ${this.state.name}`;
17 | }
18 |
19 | render() {
20 | return (
21 |
22 |
Use the input field below to rename this page!
23 |
this.setState({ name: target.value })}
25 | value={this.state.name}
26 | type='text' />
27 |
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.1_Why_Use_useEffect/PageTitleClass.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 |
3 | export default class PageTitle extends Component {
4 | constructor(props) {
5 | super(props);
6 | this.state = {
7 | name: ''
8 | };
9 | }
10 |
11 | componentDidMount() {
12 | document.title = this.state.name;
13 | }
14 |
15 | componentDidUpdate() {
16 | document.title == `Hi, ${this.state.name}`;
17 | }
18 |
19 | render() {
20 | return (
21 |
22 |
Use the input field below to rename this page!
23 |
this.setState({ name: target.value })}
25 | value={this.state.name}
26 | type='text' />
27 |
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.2_Update_Function_Component_State/ColorPicker.js:
--------------------------------------------------------------------------------
1 | // import the default export and the named export `useState` from the 'react' library
2 | import React, { useState } from "react";
3 |
4 | export default function ColorPicker() {
5 | // call useState and assign its return values to `color` and `setColor`
6 | const [color, setColor] = useState();
7 |
8 | const divStyle = { backgroundColor: color };
9 |
10 | return (
11 |
12 |
The color is {color}
13 |
setColor('Aquamarine')}>Aquamarine
14 |
setColor('BlueViolet')}>BlueViolet
15 |
setColor('Chartreuse')}>Chartreuse
16 |
setColor('CornflowerBlue')}>CornflowerBlue
17 |
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/7_Additional_React_Basics/7.4_React_Forms/7.4.4_Set_the_Input_s_Initial_State/Input.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | export class Input extends React.Component {
5 | constructor(props) {
6 | super(props);
7 | this.state = { userInput: '' };
8 | this.handleUserInput = this.handleUserInput.bind(this);
9 | }
10 |
11 | handleUserInput(e) {
12 | this.setState({
13 | userInput: e.target.value
14 | });
15 | }
16 |
17 | render() {
18 | return (
19 |
20 |
24 |
I am an h1.
25 |
26 | );
27 | }
28 | }
29 |
30 | ReactDOM.render(
31 | ,
32 | document.getElementById('app')
33 | );
34 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.5_Fetch_Data/test/test.js:
--------------------------------------------------------------------------------
1 | const shallow = require('enzyme/shallow');
2 | const rewire = require('rewire');
3 |
4 | describe('', function () {
5 |
6 | it('', function () {
7 | let wrapper;
8 | try {
9 | const appModule = rewire('../Forecast');
10 | const Forecast = appModule.__get__('Forecast');
11 | wrapper = shallow( );
12 | } catch (e) {
13 | expect(
14 | false,
15 | 'An error is being thrown when trying to render this component. If there is no data, return `Loading...
` instead of trying to map over `undefined` data',
16 | ).to.be.true;
17 | }
18 | expect(
19 | wrapper.find('p'),
20 | '` ` should render a `` element before the data has loaded',
21 | ).to.have.lengthOf(1);
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/6_Stateless_Component_From_Stateful_Components/6.2_Child_Components_Update_Their_Parents_state/6.2.3_Pass_the_Event_Handler/test/test.js:
--------------------------------------------------------------------------------
1 | let shallow = require('enzyme/shallow'),
2 | appModule = require('../Parent'),
3 | components = appModule.__ReactComponents,
4 | TestedComponent = components[0];
5 |
6 | describe('', function () {
7 | it('', function () {
8 | let wrapper = shallow( );
9 |
10 | expect(
11 | typeof wrapper.instance().changeName,
12 | '`` should have a `changeName()` method.'
13 | ).to.equal('function');
14 |
15 | wrapper.instance().changeName('Glornald');
16 | expect(
17 | wrapper.state(),
18 | "``'s `changeName()` method should have a `newName` parameter. It should call `this.setState({ name: newName })`."
19 | ).to.eql({ name: 'Glornald' });
20 | });
21 | });
22 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.1_Why_Use_Hooks/Presentational/NewTask.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export default function NewTask({ newTask, handleChange, handleSubmit }) {
4 | return (
5 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/5_Hooks/5.2_The_State_Hook/5.2.9_Lesson_Review/Presentational/NewTask.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export default function NewTask({ newTask, handleChange, handleSubmit }) {
4 | return (
5 |
6 |
12 | {!newTask.title ? null : (
13 | <>
14 |
20 | Add Task
21 | >
22 | )}
23 |
24 | );
25 | }
26 |
--------------------------------------------------------------------------------
/5_Hooks/5.3_The_Effect_Hook/5.3.7_Separate_Hooks_for_Separate_Effects/styles.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | background-color: #ffffff;
4 | text-align: center;
5 | margin: 0;
6 | }
7 |
8 | * {
9 | font-family: Helvetica, Arial, sans-serif;
10 | box-sizing: border-box;
11 | }
12 |
13 | #app {
14 | padding: 8px;
15 | }
16 |
17 | .content {
18 | display: flex;
19 | justify-content: space-evenly;
20 | overflow: hidden;
21 | }
22 |
23 | section {
24 | overflow: scroll;
25 | max-height: 80vh;
26 | padding: 0 40px 0;
27 | margin: 20px;
28 | }
29 |
30 | ul {
31 | list-style: none;
32 | position: relative;
33 | padding: 0;
34 | margin: 0;
35 | }
36 |
37 | li {
38 | padding-left: 1.5em;
39 | }
40 |
41 | li:before {
42 | position: absolute;
43 | content: "•";
44 | color: green;
45 | left: 0;
46 | }
47 |
48 | li.offline:before {
49 | color: red;
50 | }
51 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.5_Call_this.setState_from_Another_Function/Toggle.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const green = '#39D1B4';
5 | const yellow = '#FFD712';
6 |
7 | class Toggle extends React.Component {
8 | constructor(props) {
9 | super(props)
10 | this.state = { color: green }
11 | this.changeColor = this.changeColor.bind(this);
12 | }
13 |
14 | changeColor() {
15 | const newColor = this.state.color == green ? yellow : green;
16 | this.setState({ color: newColor });
17 | }
18 |
19 | render() {
20 | return (
21 |
22 |
23 | Change color
24 |
25 |
26 | );
27 | }
28 | }
29 |
30 | ReactDOM.render( , document.getElementById('app'))
31 |
--------------------------------------------------------------------------------
/3_Components_Interacting/3.3_this.state/3.3.6_this.setState_Automatically_Calls_render/Toggle.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 |
4 | const green = '#39D1B4';
5 | const yellow = '#FFD712';
6 |
7 | class Toggle extends React.Component {
8 | constructor(props) {
9 | super(props)
10 | this.state = { color: green }
11 | this.changeColor = this.changeColor.bind(this);
12 | }
13 |
14 | changeColor() {
15 | const newColor = this.state.color == green ? yellow : green;
16 | this.setState({ color: newColor });
17 | }
18 |
19 | render() {
20 | return (
21 |
22 |
23 | Change color
24 |
25 |
26 | );
27 | }
28 | }
29 |
30 | ReactDOM.render( , document.getElementById('app'))
31 |
--------------------------------------------------------------------------------