npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hymns-of-web/use-easy-google-form

v2.0.0

Published

Easily post google forms using react hook

Downloads

7

Readme

Easy Google Form React Hook

Great to have ( If you want to make your life easier )

Click here and download the extension present there. If this extension is installed, it'll automatically create a react form component in your google forms web page, you just have to copy paste hehe ;)

FYI

This hook still don't support the following question types in google form:

  • File upload
  • Grid
  • Scale

Installation

Run npm install @hymns-of-web/use-easy-google-form or yarn add @hymns-of-web/use-easy-google-form to install the package.

Usage

I recommend you to use the extension mentioned above, and then modify the code if needed. But in case you want the satan to worship you and do stuff manually, follow the steps below.

  1. Create a google form and add questions to it.
  2. Click on the three dots on the top right corner of the form and click on "Get pre-filled link".
  3. Inspect and find input elements with name attribute's value starting with entry. for each question. (refer this website)
  4. Get the id of the google form from the url.
  5. Create a react component and import the hook.
  6. To use the hook, you need to pass in 3 mandatory parameters:
    • gFormId: The id of the form (from step 4).
    • formRef: The ref of the form element.
    • links: Now this is a bit tricky. Links must be an array of objects, where each object must have entryId, formId and type. The entryId is the name value of the input in google form prefil page (step 3), the formId is the id of the element in your own react form (step 7). The type is the type of the input element in your react form. The type can be one of the following:
      • text
      • radio
      • textarea
      • checkbox
      • date
      • dropdown
      • time
  7. The element to which you will be giving an id to pass in to the form id in the above step varies depending on the type. Please refer the following table for the same: | type | element | description | |----------|------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | text | input | The hook will look for #<input_id>.value | | textarea | textarea | The hook will look for #<textarea_id>.value | | radio | Container type elements(div, section, etc) | The hook will look for input:checked selector inside the container. | | checkbox | Container type elements(div, section, etc) | The hook will look for input:checked selector inside the container. | | dropdown | select | The hook will look for #<select_id>.value | | date | Container type elements(div, section, etc) | Must have different input elements for different date parts inside the container. The type must be string or number for each input element. The inputs must be distinguished via name attribute with the values: day, month and year. You can ignore year input IF you don't have year in your google form input. Months start from index 1.The hook will look for input[name=<day, month and year>] | | time | Container type elements(div, section, etc) | Almost same as date but instead of day, month and year, you have to keep hours, minutes and seconds (seconds only if you have selected duration rather than time in your google form).The time must be in 24-hour format. |
  8. The hook returns an onSubmit function which you can pass to the onSubmit prop of the form element.
  9. There are 2 optional parameters that you can pass to the hook:
    • onSubmitExtra: A callback function that will be called when the logic of the hook is done.
    • extraEntries: An array of objects, where each object must have entryId and value. The entryId is the name value of the input in google form prefil page (step 3), the value is the value that you want to pass to the google form. This is useful when you want to pass some extra data to the google form that is not present in your react form.
  10. You can see an example at: Github & Live Link