mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #2508 from jsfb/monitor-with-context
Start monitoring uses of withContext, related to issue #2112
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
var assign = require('Object.assign');
|
||||
var emptyObject = require('emptyObject');
|
||||
var monitorCodeUse = require('monitorCodeUse');
|
||||
|
||||
/**
|
||||
* Keeps track of the current context.
|
||||
@@ -45,6 +46,8 @@ var ReactContext = {
|
||||
* @return {ReactComponent|array<ReactComponent>}
|
||||
*/
|
||||
withContext: function(newContext, scopedCallback) {
|
||||
monitorCodeUse('react_with_context', {newContext: newContext});
|
||||
|
||||
var result;
|
||||
var previousContext = ReactContext.current;
|
||||
ReactContext.current = assign({}, previousContext, newContext);
|
||||
|
||||
Reference in New Issue
Block a user