Sunday, 3 October 2021

React JS questions

  1. Remove duplicate characters in array of elements
  2. Given word last letter should be capital.
  3. Closure function
  4. diff class component, functional component
  5. Error Handling in React.
  6. how to give generic exception and display the message
  7. error boundaris
  8. what is call back hell function
  9. what is non blocking io---asyncronous call
  10. what is stright mode
  11. Differenec Virtual dom and Real dom.
  12. react life cycle
  13. what is promise unchining,promise.all-- promise is asyncronous call
  14. diff let,var,const
  15. what is closur function,nested function
  16. basic ES6 features- let and var,promise,iterator
  17. How to deploy React application
  18. React Router types how it works,nested routes
  19. What is Arrow function,uses
  20. spread operator
  21. what is generator
  22. what is hooks- use memo,use context,use effect
  23. How redux works
  24. diff element and component
  25. how to prevent rerendering-- using pure componentd or use memo
  26. React application performence.
  27. synthatic events.
  28. what is controlled components
  29. how to set initial state in Redux
  30. Store in Redux
  31. How many types are Reducers
  32. Redux life cycle
  33. Diff State and props
  34. what is Data binding
  35. What is context API

Javascript:
  1. diff betewen Null and undefined
  2. typeof(null)
  3. Event bubling
  4. Define Json array
  5. how to detect object like mobile or tab-- using responsiveness media query
  6. purpose of encoding url
  7. what is decorater
  8. copy an object in javascript-- object

  1. Remove duplicate characters in array of elements
    • const uniqueNames = Array.from(new Set(names));
  1. Given word last letter should be capital.
  • const cap = str => str
                         .split(' ')
                         .map(x => (
                             x.length === 1 ? 
                                 x.toUpperCase() : 
                                `${x[0].toUpperCase()}${x.slice(1,-1)}${x[x.length -1].toUpperCase()}`)
                         )  
                         .join(' ')
    
    console.log(cap("a quick brown fox"))
    1. diff class component, functional component
  • There is no render method used in functional components.

    React lifecycle methods (for example, componentDidMount) cannot be used in functional components.
    It must have the render() method returning HTML
    React lifecycle methods can be used inside class components (for example, componentDidMount).