Машинный код React внезапно перестал работать

#javascript #node.js #reactjs #react-native #expo

#javascript #node.js #reactjs #react-native #выставка

Вопрос:

Я имею дело с очень странной проблемой. Мой машинный код React работал нормально до вчерашнего дня. Я пытался импортировать данные FB (идентификатор пользователя, изображение профиля и т. Д.) И до вчерашнего дня успешно мог видеть идентификатор пользователя FB в своем приложении. Внезапно я больше не вижу его..

Я получаю следующий журнал, когда использую expo start и просто пустой экран на моем телефоне. Я также попытался очистить кеш и обновить expo-cli.. Любые указатели будут высоко оценены.

 Running application on Redmi 6 Pro.

Warning: componentWillMount has been renamed, and is not recommended for use. See 

fb.me/react-unsafe-component-lifecycles for details.

* Move code with side effects to componentDidMount, and set initial state in the constructor.
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: %s, Login
- node_modulesreact-nativeLibrariesLogBoxLogBox.js:117:10 in registerWarning
- node_modulesreact-nativeLibrariesLogBoxLogBox.js:63:8 in warnImpl
- node_modulesreact-nativeLibrariesLogBoxLogBox.js:36:4 in console.warn
- node_modulesexpobuildenvironmentreact-native-logs.fx.js:18:4 in warn
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:106:4 in printWarning
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:60:16 in warn
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:5846:10 in ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:19093:6 in flushRenderPhaseStrictModeWarningsInDEV      
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:18335:41 in commitRootImpl
* [native code]:null in commitRootImpl
- node_modulesschedulercjsscheduler.development.js:653:23 in unstable_runWithPriority
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:18317:17 in commitRoot
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:17697:12 in performSyncWorkOnRoot
* [native code]:null in performSyncWorkOnRoot
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:5321:31 in runWithPriority$argument_1
- node_modulesschedulercjsscheduler.development.js:653:23 in unstable_runWithPriority
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:5316:21 in flushSyncCallbackQueueImpl
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:5304:28 in flushSyncCallbackQueue
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:17125:30 in scheduleUpdateOnFiber
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:20527:14 in updateContainer
- node_modulesreact-nativeLibrariesRendererimplementationsReactNativeRenderer-dev.js:21068:17 in render
- node_modulesreact-nativeLibrariesReactNativerenderApplication.js:54:4 in renderApplication
- node_modulesreact-nativeLibrariesReactNativeAppRegistry.js:117:25 in runnables.appKey.run
- node_modulesreact-nativeLibrariesReactNativeAppRegistry.js:213:4 in runApplication
- node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:416:4 in __callFunction
- node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:109:6 in __guard$argument_0
- node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:364:10 in __guard
- node_modulesreact-nativeLibrariesBatchedBridgeMessageQueue.js:108:4 in callFunctionReturnFlushedQueue
* [native code]:null in callFunctionReturnFlushedQueue
 

Лучше всего,
Нитин

Комментарии:

1. Вы выполнили все рекомендации в этом выводе? Довольно ясно, что вам нужно сделать из этого вывода

2. componentWillMount для всех практических целей устарел и существует уже год, полтора года (версия 16.3.0). reactjs.org/blog/2018/03/29 /. … React даже предоставил скрипт, помогающий автоматизировать обновление: github.com/reactjs/react-codemod#rename-unsafe-lifecycles .

3. Я согласен, что игнорировал предупреждения, но до вчерашнего дня код работал нормально. Я мог видеть вывод на своем телефоне.. Я обновлю и посмотрю, работает ли это..

4. удалите папку модулей узла, затем запустите npm install и попробуйте.

5. Это всего лишь предупреждение, а не ошибка, поэтому оно, вероятно, все еще будет работать (на данный момент), но, учитывая, что React предупреждает разработчиков об обновлении уже более года, и предупреждения постепенно усиливаются, хорошо… в какой-то момент они должны нарисовать линию. В любом случае, можно просто обновить и использовать более правильные методы жизненного цикла.