Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useState intro

import { useState } from 'react';

function App() {
  const resultFromUseStateHook = useState('initial value of a piece of state');

  console.log('A reference to the piece of state:', resultFromUseStateHook[0]);
  console.log('A function to update this piece of state:', resultFromUseStateHook[1]);
}

export default App;
Source by learn-2.galvanize.com #
 
PREVIOUS NEXT
Tagged: #useState #intro
ADD COMMENT
Topic
Name
4+3 =