How to use the hops.withServerData function in hops

To help you get started, we’ve selected a few hops examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xing / hops / packages / spec / integration / react / index.js View on Github external
Miss,
  render,
  withServerData,
  useServerData,
  Status,
  withConfig,
  useConfig,
} from 'hops';

import React from 'react';
import { Link, Redirect, Route, Switch } from 'react-router-dom';
import FlowText from './flow-text';

const Text = importComponent(() => import('./text'));

const ServerDataHoC = withServerData(({ serverData }) => (
  <output>{serverData.method}</output>
));

const ServerDataHook = () =&gt; {
  const serverData = useServerData();

  return <output>{serverData.method}</output>;
};

const ConfigHoC = withConfig(({ config: { hoc } }) =&gt; <h1>{hoc}</h1>);

const ConfigHook = () =&gt; {
  const config = useConfig();

  return <h1>{config.hook}</h1>;
};

hops

Hops main Package to build and run Hops applications

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis