Giter Site home page Giter Site logo

youtube-video's Introduction

React Best Practices

  1. We always create one component per file. No matter how small it is.
  2. Normaly we call React Components a functional component. because it literally a function. there is another type of component in React is Class Component. It use to some type of record keeping.
var SearchBar = () => {
    return <input />
}
  1. Class Based components must have render method declaration. Otherwise you will get an error.
  2. You should always start with functional Components and while refactoring you can introduce class based component to make them more intelligent.
  3. State is a plain javascript object that is use to record in react to use events. Each class based component that we define as it's onw state object. what ever a component state change, component immidiatly rerendered and it also forces all of it's childers to be rerendered as well.
  4. Functional components do not have state only class based components do.
  5. State is a plain javascript object that is used to record in React an user events.
  6. You must update state by using this.setState() throughout the component except in constructor of the class based component.
  7. Controlled field is a form element (like input) whose value is set by the state property. and it's value changes only when the state changes.
  8. To instantiat an object of js class in JSX just put name of the class with angle brackets. Where App is the class.
  9. Event handler is the function in the class that should be ran whenever the event occurs.
  10. We pass the event handlers to the element we want to monitor for events.
  11. Each class based component that we define has it's own state object. Whenever component state changed, component immidiatly rerendered. and also forces all of it's childerns to rerender as well.
  12. On top of Redux, we have Webpack, Redux Router, React Router, Redux Promise, Redux thunk.
  13. Redux contains the state of the whole application.
  14. Redux is more about to control the data.
  15. In Redux, Reducer is just a function which returns the application state. Since one application can have many different pieces of states hence we can have many different reducers.
  16. An application state generates by the Reducer function.
  17. Redux servers to constuct an application state and react provides the view to display that state.
  18. Action creator is a function that return an action.
  19. Action creator returns an object called action. and returned action automatically sent to all reducers.
  20. In redux State is an application state. Whereas in React state is the component state and both states are not connected in any way. Even redux should call their state variable something else.

youtube-video's People

Contributors

tarunjangra avatar

Watchers

James Cloos avatar Narinder Kaur avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.