Skip to content

What's new in v4.1.0

Choose a tag to compare

@KiranMantha KiranMantha released this 12 Feb 13:21
· 104 commits to master since this release

The new update comes with big updates. Signals are now available in core package. This big feature enables plugin system. Not only this, the routing mechanism got few updates. The ecosystem finally got Forms scoped package which enable seemless form creation (this is in its nacent stage).

Signals

This is the most important inclusion in core package. Signals now enable more flexibility in creating utilities. Best example is forms package. This package expose FormBuilder class to define forms. it is just a class not a component / service. so how it introduced reactivity is via signals.

How to create a signal

Simple.

  • import signal from @plumejs/core
  • in beforeMount lifecycle hook initiate signal as this.your_variable = signal(1).
    a. Note the signals should be initiated in beforeMount lifecycle only.
    b. Note the signal requires initial value. If you are using typescript, the type of signal is infered from the initial value.
  • to read the signal value: this.your_variable()
  • to update the signal value call: this.your_variable.set(2) or this.your_variable.set((initialVal) => initialVal + 1)
  • As soon as the set is called, it register re-render signal of component. with this, even though you are using multiple signals and setting multiple signal values the re-render occurs once.

Breaking Changes

The new update also got some breaking changes too:

  • onbindprops will not work. instead pass the props using data-input attribute on child component. This helps code to be more readable and less verbose.
  • all types of hooks are removed in-favor of signals. infact Signals will support any type of data.