Forum Discussion
Djemel Guizani
Oct 30, 2016Copper Contributor
MDS and React
I've build a simple React component using UI Fabric. The component is created in a static method from a class (TypeScript). Script is loaded from a Custom Action and made MDS compatible using Regist...
Shawn Xiong
Oct 31, 2016Brass Contributor
were you doing something similar to below:
if ("undefined" != typeof g_MinimalDownload && g_MinimalDownload) {
// Register script for MDS if possible
console.log('MDS enabled.');
RegisterModuleInit( _spPageContextInfo.webAbsoluteUrl + "/Style Library/MDS.js", RemoteManager_Inject); //MDS registration
console.log('Register Module after Init');
NonMDS(); //non MDS run
} else {
console.log('MDS not enabled.');
NonMDS();
}
function NonMDS(){
console.log('Non MDS run...');
}
function RemoteManager_Inject() {
console.log('Remote Manager Inject');
}
Djemel Guizani
Oct 31, 2016Copper Contributor
Yes - something very similar and it works fine.
I've managed to "destroy" the old component (the one create from previous page load) by keeping a reference to the HTML element and calling ReactDOM.unmountComponentAtNode and then calling ReactDOM.render to build a new one.
I now have only instance of my component displayed in React DevTool but I still have issue with the evens. They are not triggered.
Digging in react.js...