GithubHelp home page GithubHelp logo

doc22940 / use-custom-hook Goto Github PK

View Code? Open in Web Editor NEW

This project forked from colbyfayock/use-custom-hook

1.0 0.0 0.0 248 KB

⚛️ A starter template for creating a new React Hook

Home Page: https://use-custom-hook.netlify.com/

License: MIT License

JavaScript 100.00%

use-custom-hook's Introduction

🧰 useCustomHook: React Hook Starter

A starter template for creating a new React Hook.

🚀 Getting Started

tl;dr

  • git clone https://github.com/colbyfayock/use-custom-hook [directory]
  • cd [directory]
  • yarn install && yarn setup
  • cd [hook-name] && npm publish

Set up a new repository

  • Clone the useCustomHook repo locally and navigate to the project
git clone https://github.com/colbyfayock/use-custom-hook [directory]
cd [directory]
  • Install packages
yarn install
  • Run setup scripts
yarn setup

During this process, the scripts will ask you for your name and your custom hook's name, including both a camelCase variation (useCustomHook) and a snake-case variation (use-custom-hook).

It will replace all instances of the default useCustomHook name with your chosen name. Additionally, it will replace the name in the license and author name in the hook's package.json file with your name.

Lastly, the script will clean up the setup scripts and reset the git history with a fresh commit.

This can only be ran once, as it will clean up the script files immediately after running.

Make sure you remember to update your email address, author URL, git addresses, and anything else within the [hook-name]/package.json file.

Developing with your hook

Running yarn develop in the root of this project will kick off a watch command in both the example and hook workspaces. This means any time you make a change to the hook, it will build, and subsequently, your example page will refresh with that new hook build.

Updating the example

There's an example app set up in the example directory. You can use this space to add examples and any preferred documentation for your custom hook.

Publishing

  • Navigate to your hook directory (default is use-custom-hook)
cd [hook-name]
  • Log in to npm
npm login
  • Publish 🎉
npm publish

Depliying your example

Running yarn build in the root directory will create a new static build of the example website available in the example/out folder. This is standard HTML that can be uploaded to any static hosting software.

use-custom-hook's People

Contributors

colbyfayock avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.