Skip to content

Instantly share code, notes, and snippets.

@johnfkneafsey
Created January 9, 2017 21:54
Show Gist options
  • Save johnfkneafsey/d0d24325c4ec9628ac4dcd07053c6cab to your computer and use it in GitHub Desktop.
Save johnfkneafsey/d0d24325c4ec9628ac4dcd07053c6cab to your computer and use it in GitHub Desktop.
1) How do you define a stateless component in React?
A component that does not contain state - all information is passed to it from a parent function.
2) How do you define a stateful component?
A component that contains state - an object that can be stored as part of the component and updated by the component itself.
3) How would you access and modify the state in a stateful component?
State is accessed and modified through the this.state command.
4) What is the difference between state and props?
They are similar but state has more persistance. State is used to store the data that your application needs. Props are pieces of data that are passed from parent to child functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment