GetInitialProps
GetInitialProps is a usually an async function which is good for asynchronous operations at the server and passes data to the page as props.
1. In Next.js it always runs at the server, if the page is called using Link then it is only called at the client side.
2. It can only be used in pages not in components.
ComponentWillMount
1. It is a lifecyle hook. It is called just before the render method is called. Data fetched in it cannot be passed in as a prop.
2. It can be called in a component as well as in pages. It is not a good place to make asynchronous calls as it doesn't wait for the async operation to complete. So if it runs at the server and your async operation is written in it, it will not get completed and it comes to the client without getting data.