webmiddle

webmiddle

  • Getting Started
  • GitHub

›webmiddle

Introduction

  • Getting Started
  • Main concepts
  • Starter App

webmiddle

  • Evaluate
  • Resources
  • ErrorBoundary
  • WithOptions

Control Flow

  • Pipe
  • Parallel

Fetching

  • HttpRequest
  • Browser
  • Cookie Manager

Transforming

  • CheerioToJson
  • JSONSelectToJson

Storing

  • Resume

Remote execution

  • Server
  • Client

WithOptions

A component that evaluates its only child by extending the current context with the new given options.

Properties

NameDescription
childrenArray containing a single child that should be evaluated.
...optionsAll the other passed properties are used as the new context options.

Example

import { rootContext, WithOptions } from 'webmiddle';

const ReturnOption = ({ optionName }, context) => context.createResource(
  "result",
  "text/plain",
  context.options[optionName],
);

const Component = () => (
  <WithOptions foo="bar">
    <ReturnOption optionName="foo" />
  </WithOptions>
);

rootContext.extend({
  foo: "some"
}).evaluate(
  <Component />
).then(resource => {
  console.log(resource.content); // "bar"
});
← PreviousNext →
  • Properties
  • Example
webmiddle
Docs
Getting StartedMain ConceptsStarter App
Community
Stack OverflowTwitter
More
GitHubStar
Copyright © 2018 Manuel Dell'Elce