Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions react_ujs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ var ReactRailsUJS = {
useContext: function(requireContext) {
this.getConstructor = constructorFromRequireContextWithGlobalFallback(requireContext)
},

// Called after React unmounts component at `node`
// Override this function to perform any cleanup
// the default function does nothing
onComponentUnmountAtNode: function (node) {},

// Render `componentName` with `props` to a string,
// using the specified `renderFunction` from `react-dom/server`.
Expand Down Expand Up @@ -135,6 +140,7 @@ var ReactRailsUJS = {
for (var i = 0; i < nodes.length; ++i) {
var node = nodes[i];
ReactDOM.unmountComponentAtNode(node);
ReactRailsUJS.onComponentUnmountAtNode(node);
}
},

Expand Down