Microsoft has Removing Code-Based Sandbox Solutions in SharePoint Online then how to deploy custom webpart Is any alternative way?
2 Answers
Now, you can't deploy any Code-Based Sandbox Solutions/custom webparts directly in SharePoint online. But in SharePoint provider hosted app you can use server side code/C#.
Apart from this, You can use JSOM, REST API based solutions, SharePoint hosted apps in SharePoint online.
In addition to Vishal's answer, there is also the new client-side development framework called 'SharePoint Framework' (spfx) which is currently in the preview phase.
https://blogs.office.com/2016/05/04/the-sharepoint-framework-an-open-and-connected-platform/