1.0.0 • Published 7 years ago

sync-will-mount v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

sync-will-mount

Middleware for express that is making componentWillMount synchronize on server render

More developers find the way for react server render; So I've written a module to override react-dom for server render. No component static method, no decorators, and no any hook on module export. Just put actions on componentWillMount if some data you wait to render form server for seo. the lifecycle will wait for promise, like this:

->componentWillMount ->redux middleware ->sync request ->next to other middleware ->reducers ->render

Try it, and if it has something problem, please let me know or create issue to me.

THX

Install

$ npm install sync-will-mount --save

Usage for your entry file

// require when your store initial on server
const syncWillMount = require("sync-will-mount")
const initAsyncBeApi = syncWillMount(remoteDataUrl);
middlewares = [initAsyncBeApi(req)].concat(middlewares || []);

Component you want to render with data

// componentWillMount
componentWillMount() {
	action1();
	action2(()=>{
		action3();
	});
}
1.0.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago