react - simple hello world component

 

To create a simple hello world react component, i used the following to create my component.


import { useState } from 'react';
type ButtonProps = {
  childrenReact.ReactNode;
};

export const MyCounter = (propsButtonProps=> {
  const [countsetCount] = useState(0);
  return (
    <>
      <button onClick={() => setCount((count=> count + 1)}>
        mycount is {count}
      </button>{' '}
    </>
  );
};


Then i wired it up using 

import { MyCounter } from './mycounter';




function App() {
  return (
    <>     
        <MyCounter />
    </>
  );
}

Example code: 

https://stackblitz.com/edit/vitejs-vite-fx2pxk

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm