Basics Flashcards
What is React ?
It is JavaScript Library to create websites, allows us to create single page apps
Create react app
npx create-react-app websitename
What is react hooks
React hooks are the built-in functions that permit the use state and life cycle methods in react components.
.map() array method does what?
.map() modifies existing array and returns new array
What are props
Props are passed to components just as arguments to functions
Render() in react
Every component in react has to return HTML. Render() is used for this
What is store
Store is single source of truth and it includes the entire application state
Declare constant in react
Export const var_name = “value”
JSON.stringify(obj)
Converts from a JavaScript value to a JSON string
Hook rules
1.Cannot be conditional
2. Can only be called at the top level of component
3.Can only be called inside react function components.
Higher-order components
1.Acts as a container for other components.
2.Keeps components simple and reusable.
3.Acts as a decorator for components and adds functionality