- What is the difference between props and state in React?
- When would you use state instead of props?
- Take a look at
https://learning.flatironschool.com
. Pretend you were going to recreate a specific page. What top level components would you have? What props would they receive and what state would they own? What components would they have as children?
Created
November 24, 2022 10:41
-
-
Save AllanSaleh/c308b83d232048c6a5ebc8388488793a to your computer and use it in GitHub Desktop.
akbulatesra
commented
Nov 24, 2022
- state controlled inside component but probs can controlled by external components
- if I cant change datas outside of the component I use state. Use state to store the data your current page needs in your controller-view.
- Props allow us to pass different variables from parent to child component. State changes variable's situation within the same component.
- When we want to change variable inside the component.
- Top level components: App>Navbar, Footer, Mid-section
-Nadim, Batoul, Sena
1- Props for read only and can not modified in the other side state changes can be asynchronous and can be modified using this.setState
2- State use within a class component it is for managing data and props used when want to pass data.
Seaed - Helin - tasnim
1.Props: are known as properties it can be used to pass data from one component to another. Props cannot be modified, read-only, and Immutable
State: The state represents parts of an application that can change. Each component can have its State, and it is local.
2) we use the state to store and change the data.
Yusuf - Sara- Rabia
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment