0.0.27 • Published 4 years ago

divjoy-components v0.0.27

Weekly downloads
81
License
-
Repository
-
Last release
4 years ago

This project was created with Divjoy

👉 Get Started

Install dependencies

npm install

Install the ZEIT Now CLI

npm install -g now

Run the development server

now dev

When the above command completes you'll be able to view your website at http://localhost:3000.

Note: You can run just the front-end with npm run start, but now dev also handles running your API endpoints (located in the /api directory).

🥞 Stack

This project uses the following libraries and services:

📚 Guide

function MyComponent(){ // Get the router object const router = useRouter();

// Get value from query string (?postId=123) or route param (/:postId)
console.log(router.query.postId);

// Get current pathname
console.log(router.pathname)

// Navigate with the <Link> component or with router.push()
return (
  <div>
    <Link to="/about">About</Link>
    <button onClick={(e) => router.push('/about')}>About</button>
  </div>
);

}

</p>
</details>

<details>
<summary><b>Authentication</b></summary>

<p>
  This project uses <a href="https://firebase.google.com">Firebase Auth</a> and includes a convenient <code>useAuth</code> hook (located in <code><a href="src/util/auth.js">src/util/auth.js</a></code>) that wraps Firebase and gives you common authentication methods. Depending on your needs you may want to edit this file and expose more Firebase functionality.

```js
import { useAuth } from './../util/auth.js';

function MyComponent(){
  // Get the auth object in any component
  const auth = useAuth();

  // Depending on auth state show signin or signout button
  // auth.user will either be an object, null when loading, or false if signed out
  return (
    <div>
      {auth.user ? (
        <button onClick={(e) => auth.signout()}>Signout</button>
      ) : (
        <button onClick={(e) => auth.signin('hello@divjoy.com', 'yolo')}>Signin</button>
      )}
    </div>
  );
}
npm install -g now

Then run this command in your project directory to deploy to ZEIT Now

now

See the ZEIT docs for more details.

0.0.27

4 years ago

0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago