Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('allows to require hops runtime code', () => {
const hops = require('hops');
expect(hops.render).toBeDefined();
});
import { render, importComponent } from 'hops';
import * as React from 'react';
import Headline from './headline';
const Content = importComponent(() => import('./content'));
export default render(
<>
<content>
);
</content>
Header,
importComponent,
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 = () => {
const serverData = useServerData();
return <output>{serverData.method}</output>;
};
const ConfigHoC = withConfig(({ config: { hoc } }) => <h1>{hoc}</h1>);
const ConfigHook = () => {
const config = useConfig();
import React from 'react';
import { importComponent, render } from 'hops';
const Text = importComponent('./text');
const loader = load =>
Promise.race([new Promise((_, reject) => setTimeout(reject, 10000)), load()]);
const renderText = ({ Component, loading, ...props }) => {
return loading ? <p>Fetching content…</p> : ;
};
export function App() {
return
import React, { createClass, PropTypes } from 'react';
import { Route } from 'react-router';
import { connect } from 'react-redux';
import { render, register } from 'hops';
import { headline } from './style.css';
const type = 'updateGreeting';
const select = register('home', (state = {}, action) => (
(action.type !== type) ? state : { ...state, greeting: action.payload }
));
const update = (payload) => ({ type, payload });
const Home = connect(select, { update })(
createClass({
displayName: 'Home',
propTypes: {
greeting: PropTypes.string,
update: PropTypes.func
},
componentDidMount() {
this.props.update('Hello World!');
},
render() {
return (
'Clean up artifacts in build / cache directories before ' +
'building',
type: 'boolean',
},
},
handler: function developHandler(argv) {
if (argv.static) {
process.env.HOPS_MODE = 'static';
}
require('..').runServer(argv);
},
});
};
if (require.main === module) {
require('hops').run(module.exports, 'develop');
}
const ConfigHook = () => {
const config = useConfig();
return <h1>{config.hook}</h1>;
};
const ServerDataHook = () => {
const serverData = useServerData();
return <output>{serverData.method}</output>;
};
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 = () => {
const serverData = useServerData();
return <output>{serverData.method}</output>;
};
const ConfigHoC = withConfig(({ config: { hoc } }) => <h1>{hoc}</h1>);
const ConfigHook = () => {
const config = useConfig();
return <h1>{config.hook}</h1>;
};
export default render(
<div>
Link to two
</div>
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 = () => {
const serverData = useServerData();
return <output>{serverData.method}</output>;
};
const ConfigHoC = withConfig(({ config: { hoc } }) => <h1>{hoc}</h1>);
const ConfigHook = () => {
const config = useConfig();
return <h1>{config.hook}</h1>;
};