Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use in koajs v2 #12

Closed
lonelyclick opened this issue Feb 17, 2016 · 2 comments
Closed

how to use in koajs v2 #12

lonelyclick opened this issue Feb 17, 2016 · 2 comments

Comments

@lonelyclick
Copy link

when I write this code in koajs v2

ReactDOMStream.renderToString(<Foo prop={value}/>).pipe(ctx.res)

then error comes

events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at ServerResponse.OutgoingMessage.write (_http_outgoing.js:422:15)
    at Adler32Stream.ondata (_stream_readable.js:529:20)
    at emitOne (events.js:90:13)
    at Adler32Stream.emit (events.js:182:7)
    at readableAddChunk (_stream_readable.js:147:16)
    at Adler32Stream.Readable.push (_stream_readable.js:111:10)
    at Adler32Stream.Transform.push (_stream_transform.js:127:32)
    at Adler32Stream._transform (/Users/ipconfig/dev/react-universal-starter/node_modules/react-dom-stream/lib/ReactServerAsyncRendering.js:61:12)
    at Adler32Stream.Transform._read (_stream_transform.js:166:10)

help me!!!

@lonelyclick lonelyclick changed the title how use in koajs v2 how to use in koajs v2 Feb 17, 2016
@jhen0409
Copy link

The ctx.body can be a Stream.

ctx.body = ReactDOMStream.renderToString(<Foo prop={value}/>);

@lonelyclick
Copy link
Author

It's worked,ths

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants