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

Function isInitialStateConvertible

transforms/class.js:303–318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301 };
302
303 const isInitialStateConvertible = classPath => {
304 const specPath = ReactUtils.directlyGetCreateClassSpec(classPath);
305 if (!specPath) {
306 return false;
307 }
308 const result = isGetInitialStateConstructorSafe(findGetInitialState(specPath));
309 if (!result) {
310 console.warn(
311 file.path + ': `' + ReactUtils.directlyGetComponentName(classPath) + '` ' +
312 'was skipped because of potential shadowing issues were found in ' +
313 'the React component. Rename variable declarations of `props` and/or `context` ' +
314 'in your `getInitialState` and re-run this script.'
315 );
316 }
317 return result;
318 };
319
320 const canConvertToClass = classPath => {
321 const specPath = ReactUtils.directlyGetCreateClassSpec(classPath);

Callers 1

class.jsFile · 0.85

Calls 2

findGetInitialStateFunction · 0.85

Tested by

no test coverage detected