Next Dapp Alpha

Next Dapp Alpha

  • Tutorial
  • Plugins
  • API
  • Github

›Core

CLI Tools

  • nextdapp

Core

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

Plugins

  • util
  • fb
  • account
  • web3

set

set can reactively change "Global States".

There are two places you will get set.

  • inside Global Functions
  • inside bound Components
import { bind } from "nd"

export default bind(
  ({ init, set }) => { // bound Components will get "set"
    const fn = init() // initialize Global Functions
    return (
      <div onClick={fn.func}>execute func</div>
      <div
      onClick={() => {
        set((state || 0) + 1, "state") // increment "state"
      }}
    >
     increment state
    </div>
    )
  },
  [
    "state",
    {
      func: ({ get, set }) => { // Global Functions will get "set
        set((get("state") || 0) + 1, "state") // increment "state"
      }
    }
  ]
)

set ( new_value, state_name )

To set a single Global State, use this grammar.

set("new_value", state)

set ( object )

To set multiple Global States, use this grammar.

set({ state1: "new_value1", state2: "new_value2", state3: "new_value3" })
← bindGlobal States →
  • set ( new_value, state_name )
  • set ( object )
Next Dapp Alpha
Docs
Quick StartPluginsTodo App ExampleDFINITY ExampleAPI ReferenceTroubleshootingUpdates
Community
Discord
Contributors
More
BlogBit PluginsGitHubStar
Copyright © 2021 Warashibe, Inc.