Next Dapp Alpha

Next Dapp Alpha

  • Tutorial
  • Plugins
  • API
  • Github

›Plugins

CLI Tools

  • nextdapp

Core

  • bind
  • set
  • Global States
  • Global Functions
  • Computed Values
  • Tracker
  • global
  • conf
  • .env

Plugins

  • util
  • fb
  • account
  • web3

util Plugin

util has a very simple set of states and functions, but useful utilities are to be added.

Installation

nextdapp add util

Global States

url

represents the current url with Node.js URL object if getURL is executed.

Global Functions

getURL()

gets the current page URL, parses it with Node.js URL object and sets it to url.

Regular Functions

xNil

xNil means isNotNil. Only null and undefined are false.

It's equivalent to complement(isNil) in Ramda.

import { xNil } from "nd/util"

xNil(null) // false
xNil(undefined) // false

Examples

import { useEffect } from "react"
import { bind } from "nd"
import { xNil } from "nd/util"

export default bind(
  ({ url, init }) => {
    const { getURL } = init() // initialize global function as usual
    useEffect(() => {
      getURL() // call the function
    }, [])
    return <div>{ xNil(url) ? url.hostname : "" }</div> // show hostname
  },
  [ "url", "getURL" ] // bind predefined state and function
)
← .envfb →
  • Installation
  • Global States
    • url
  • Global Functions
    • getURL()
  • Regular Functions
    • xNil
  • Examples
Next Dapp Alpha
Docs
Quick StartPluginsTodo App ExampleDFINITY ExampleAPI ReferenceTroubleshootingUpdates
Community
Discord
Contributors
More
BlogBit PluginsGitHubStar
Copyright © 2021 Warashibe, Inc.