Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useEffect : react to manipulate the DOM

import { useEffect } from 'react';

function App() {

  console.log('The value of document is:', document);

  useEffect(() => {
    console.log('I'm in useEffect!');
    document.getElementById('title').textContent = 'Not a Violin Practice Log';
  }, []);


  return (
    <div>
      <h1 id="title">Violin Practice Log</h1>
    </div>
  );
}
Source by learn-2.galvanize.com #
 
PREVIOUS NEXT
Tagged: #useEffect #react #manipulate #DOM
ADD COMMENT
Topic
Name
1+6 =