What Does Ferp Provide
An overview of exports in ferp
app()
This is the entry point to your application. An application can be describe in three pieces, init
, subscribe
, and observe
. Init is a required tuple of your initial data in the form of [initialState, initialEffect]
. Subscribe is an optional function with the signature (state) => [sub1, sub2, ...]
. Observe is an optional function with the signature ([currentState, currentEffect], action) => {}
and is used for debugging. These pieces all exist inside an object, and all together, they may look something like this:
Don't worry if this looks scary, this guide will step you through each piece, and explain how they work.
effects {}
Ferp, inspired by the likes of Elm's Cmd, exports a set of core effects that can be combined and composed to build powerful pieces of logic. Getting comfortable and familiar with these effects will enable you to use Ferp effectively.
Effects are a way to encapsulate code that affects out-of-app state. These are things like getting the system time, requesting permissions, accessing the file system, or handling user interaction.
There are a set of core effects that Ferp exposes as the effects object:
Last updated
Was this helpful?