React Personal Note

Functional Component
This a Functional component

  import React from 'react'

  function App() {
    return(
        

Hello World!

) }
Arrow Function
This a Functional component

  import React from 'react'

  const App = () => {
        return(
          

This a Arrow function

) }
Class Component
এটি একটি ক্লাস কম্পোনেন্ট

  import React, {Component} from 'react'

  class App extends Component {
    constructor(){
    super()
    this.state = {object}
  }
  render(){
  return(
    

This is a Class Component with state

) } }
Forec Update
forceUpdate() method update react component manually

  import React, {Component} from 'react'
  class Refresh extends Component {
      constructor(){
          super()
         this.freshNow = this.freshNow.bind(this)
      }
     freshNow = () => {
         this.forceUpdate()
     }    
      render(){
          return(
              <div>
                  <h2> { Math.random() } </h2>
                  <button onClick={this.freshNow} className="btn btn-warning" >Refresh </button>
              </div>
          )
      }
  }
  export default Refresh;
 
React DOM
React Have 5 Dom method

  render()
  hydrate()
  unmountComponetAtNode()
  findDOMNode()
  createPortal()
  
col-md-3