Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(() => {
const reduxState = escape(JSON.stringify(getState()));
const css = new Set();
/* eslint-disable no-underscore-dangle */
const html = ReactDOMServer.renderToString(
{ css.add(styles._getCss()); }}>
{ }
);
const head = Helmet.rewind();
res.render('index', {
html,
reduxState,
inlineCss: arrayFrom(css).join(''),
head,
isMobile,
});
})
.catch(err => next(err));
getRenderProps(feature, params.url).then(nr.createTracer('getRenderProps', (renderProps) => {
let html = null
try {
html = renderToString()
} catch (ex) {
// throw new Error(`Error: 3 - Could Not Render ${feature} view`, ex)
Raven.captureException(ex)
nr.endTransaction()
res.status(500).send({ error: 3, message: `Could Not Render ${feature} view`, ex, stack: ex.stack })
}
const initialState = Object.assign({}, startingState, store.getState(), { hosts: { nodeHost: getNodeHost(req), railsHost: params.railsHost } })
let head = Helmet.rewind()
head = {
base: head.base.toString(),
meta: head.meta.toString(),
link: head.link.toString(),
title: head.title.toString(),
script: head.script.toString()
}
// for lookinside stuff
let referrer = null
if (params.referrer) {
referrer = params.referrer
}
res.setHeader('Cache-Control', 'public')
// in development mode
if (__DEVSERVER__) {
config.link = config.link.filter(l => l.rel !== 'stylesheet');
}
const Meta = () => (
)
ReactDOMServer.renderToString();
const header = Helmet.rewind();
export default header;
const html = ({
protocol, // http or https
style, // raw styles to be embedded directly into the document
scripts, // scripts to be linked in the document body
state, // initial state of the client side store
children, // output of server side route render
}) => {
const head = Helmet.rewind();
return (
{head.base.toComponent()}
{head.title.toComponent()}
{head.meta.toComponent()}
{head.link.toComponent()}
{head.script.toComponent()}
{style &&
export default (store: Store, htmlApp: string = '') => {
const head = Helmet.rewind();
const assets = webpackIsomorphicTools.assets();
// Setup html page
return `
${head.base.toString()}
${head.title.toString()}
${head.meta.toString()}
render () {
const {assets, component, store} = this.props
const content = component ? ReactDOM.renderToString(component) : ''
const helmet = Helmet.rewind()
return (
{helmet.base.toComponent()}
{helmet.title.toComponent()}
{helmet.meta.toComponent()}
{helmet.link.toComponent()}
{helmet.script.toComponent()}
{/* styles (will be present only in production with webpack extract text plugin) */}
match({ routes, location: locals.path, basename }, (error, redirectLocation, renderProps) => {
var url;
if (redirectLocation && redirectLocation.pathname) {
url = redirectLocation.pathname;
callback(null, `
`);
}
const body = ReactDOMServer.renderToString();
const head = Helmet.rewind();
let markup = `
${head.title.toString()}
${head.meta.toString()}
<div id="app">${body}</div>
const Html = ({ body }) =>
{Helmet.rewind().meta.toComponent()}
{Helmet.rewind().title.toComponent()}
{css}
<div id="react-mount">
</div>
match({ routes, location: req.url }, (error, redirectLocation, renderProps) => {
if(error) {
res.status(500).send(error.message);
} else if(redirectLocation) {
res.redirect(302, redirectLocation.pathname + redirectLocation.search);
} else if(renderProps) {
let renderedBody = renderToString(
);
let head = Helmet.rewind();
res.status(200).send(`
${head.title.toString()}
${head.meta.toString()}
match({ routes: createRoutes({store, first: { time: true }}), location: options.url }, (error, redirectLocation, renderProps) => {
try {
if (error) {
result.error = error;
} else if (redirectLocation) {
result.redirect = redirectLocation.pathname + redirectLocation.search;
} else {
result.app = renderToString(
);
const { title, meta } = Helmet.rewind();
result.title = title;
result.meta = meta;
result.initial = JSON.stringify(store.getState());
}
} catch (e) {
result.error = e;
}
return callback(JSON.stringify(result));
});
} catch (e) {