MCPcopy Index your code
hub / github.com/reactjs/react-codemod / updatePropsAndContextAccess

Function updatePropsAndContextAccess

transforms/class.js:469–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467 ), fn);
468
469 const updatePropsAndContextAccess = getInitialState => {
470 const collection = j(getInitialState);
471
472 collection.find(j.MemberExpression, {
473 object: {
474 type: 'ThisExpression',
475 },
476 property: {
477 type: 'Identifier',
478 name: 'props',
479 },
480 }).forEach(path => j(path).replaceWith(j.identifier('props')));
481
482 collection.find(j.MemberExpression, {
483 object: {
484 type: 'ThisExpression',
485 },
486 property: {
487 type: 'Identifier',
488 name: 'context',
489 },
490 }).forEach(path => j(path).replaceWith(j.identifier('context')));
491 };
492
493
494 const inlineGetInitialState = getInitialState => {

Callers 1

createConstructorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected