Skip to content

Instantly share code, notes, and snippets.

@AllanSaleh
Created November 24, 2022 10:41
Show Gist options
  • Save AllanSaleh/c308b83d232048c6a5ebc8388488793a to your computer and use it in GitHub Desktop.
Save AllanSaleh/c308b83d232048c6a5ebc8388488793a to your computer and use it in GitHub Desktop.

Discussion Questions: Props vs. State

  1. What is the difference between props and state in React?
  2. When would you use state instead of props?
  3. 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?
@Saeed-Alsaiyed
Copy link

Saeed-Alsaiyed commented Nov 24, 2022

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

@ladycodeer
Copy link

ladycodeer commented Nov 24, 2022

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