@am-hooks/use-tab

1.0.0 • Public • Published

useTab

현재 선택한 Section 의 content 만 보여주기

Installation

yarn

yarn add @am-hooks/use-tab

npm

npm i @am-hooks/use-tab

Usage

import useTitle from "@am-hooks/use-tab";

const App = () => {
  const content = [
    {
      tab: "Secton 01",
      content: "Secton 01 Content"
    },
    {
      tab: "Secton 02",
      content: "Secton 02 Content"
    }
  ];
  const { currentItem, changeItem } = useTabs(0, content);

  return (
    <>
      <h2>useTab</h2>
      {content.map((sectoin, index) => (
          <button onClick={() => changeItem(index)}>{sectoin.tab}</button>
      ))}
      <div>{currentItem.content}</div>
    </>
  )
}



Readme

Keywords

Package Sidebar

Install

npm i @am-hooks/use-tab

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

1.65 kB

Total Files

4

Last publish

Collaborators

  • wam-6577