class components and functional...

PHOTO EMBED

Sat Feb 19 2022 18:07:27 GMT+0000 (Coordinated Universal Time)

Saved by @Rubel #redux #react

import React, { useState, useEffect } from 'react';
 
export default function PageTitle() {
  const [name, setName] = useState('');
 
 useEffect(() => {
    document.title = `Hi, ${name}`;
  }, [name]);
 
  return (
    <div>
      <p>Use {name} input field below to rename this page!</p>
      <input 
        onChange={({target}) => setName(target.value)} 
        value={name} 
        type='text' />
    </div>
  );
}

// now the entrry of great functional componentsw useEffect
content_copyCOPY

class components life cycle method & useEffect of functional