Skip to content

addamsv/laniakea-core-ts

Repository files navigation

T H E - O W N - R E A C T Lib Example

NPM version Netlify

Author: S.Adamovich (2023)
Version: 1.0.3
Necessary: Node ver: ^16.14.0 && Yarn

See Demo: https://the-react-clone.netlify.app/
npm module: https://www.npmjs.com/package/laniakea-core-ts

Get Started (install)

Install:

$ yarn

Development Mode:

$ yarn start

Build the project into 'dist' folder:

$ yarn build

What new [ver 1.0.3]

The only hooks are currently supported:

useState
useRef
useEffect (only one fn per component in ver 1.0.3)

Using setState hooks within fragments:

const FragmentWithStateHook = () => {
  const [st, setSt] = useState(1);
  const changing = () => setSt((prev: number) => prev + 1);
  return (
    <>
      <button onClick={changing}>{st.toString()}</button>
    </>
  );
};

Using more than one hook:

  /* more you can see in 'MultState.tsx' as example */
  const [st, setSt] = useState("");
  const [counter, setCounter] = useState(1);

Return element:

return isLoading ? <Preloader /> : <Examples />;