I need to develop some new web parts for SharePoint 2013, and they should be developed in such a way that they can be easily migrated to SharePoint Online at a later point. The webparts need to ideally have custom properties for configuration. I'm looking for a good approach which will involve minimum migration effort later.
As I understand, the ideal approach for webpart development now is to develop client web parts with SPFx, but SPFx cannot be used with SharePoint 2013.
I'm thinking of the following options:
Develop an Add-in part (Client Webpart). But the Add-in parts are rendered as Iframes and also I'm not sure if this is the way to go for future webpart development considering SPFx is now the modern framework for client webpart development.
So I'm a bit unsure which approach I should take.
Any inputs about the options above or any other suggestions/hints would be greatly appreciated.
Thanks a lot.
Short answer: The two are fundamentally different. I see no "good" way to "prepare for online while writing 2013".
Long answer: Maybe (maybe, maybe..) it would be possible to write the 2013 WebPart as a react or angular app and wrap acess to the properties in an adapter pattern. That way, while the code will not be "easily migratable", parts of the code can be re-used for an SPFx WebPart. I have not tested this and am really unsure if this will work as easily as sounds while writing about it.
Add-ins and Add-in-Parts
Are still a valid way to develop for SharePoint. They work in every version since 2013 and are probably the best way to "prepare for online".
Drawbacks of Add-ins are:
You'll need the add-in infrastructure on-prem. This can be a problem for some.
Add-ins are - compared to SPFx - much more "heavy".
When comparing add-in-parts to SPFx there is really no upside to using add-ins... Besides the add-ins working in every environment since 2013.
So... My input: Use Add-ins. You'll have the highest probability for "easy mirgration".