webmiddle

webmiddle

  • Getting Started
  • GitHub

›Control Flow

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

Pipe

Executes a sequence of tasks, piping the result of a task to the next task.

Install

yarn webmiddle-component-pipe

Properties

NameDescription
childrenThe tasks to execute.

Usage

import { PropTypes, rootContext } from 'webmiddle';
import Pipe from 'webmiddle-component-pipe';

const SubComponent1 = () => 'foo';
const SubComponent2 = ({ input }) => input + 'Bar';
const SubComponent3 = ({ input }) => input + 'Some';

const MyComponent = () => (
  <Pipe>
    <SubComponent1 />

    {result1 =>
      <SubComponent2
        input={result1}
      />
    }

    {result2 =>
      <SubComponent3
        input={result2}
      />
    }
  </Pipe>
);

rootContext.evaluate(<MyComponent />)
  .then(result => {
    console.log(result); // "fooBarSome"
  });

How it works

The tasks to execute are specified via children. In case a function is specified, then such function is called with the last result.

The component resolves with the result returned by the last child.

If any of the children fails, then the component fails with the error returned by the failed child.

← PreviousNext →
  • Install
  • Properties
  • Usage
  • How it works
webmiddle
Docs
Getting StartedMain ConceptsStarter App
Community
Stack OverflowTwitter
More
GitHubStar
Copyright © 2018 Manuel Dell'Elce