-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
Chain pattern:
state.with(undoFeature(4)).with(storageFeature()).with(loggerFeature());
// or (if typesafe possible?)
state.with(undoFeature(4), storageFeature(), loggerFeature())instead of "wrapper pattern":
withLogger(withStorage(withUndo(state, 4)));The above referenced chain pattern might be easier to make typesafe than:
createState({
defaultValue: 0,
features: [withUndo(), withStorage(), withLogger()]
});but still has better DX than the "wrapper pattern" I feel like.
or remove features completely? and name it plugins which might be more clear? but libraries are like called feature-xyz
state.use(undoPlugin(4), storagePlugin(), loggerPlugin())