小编Eme*_*pes的帖子

React:根据数组值设置状态

我有一系列这样的问题

[
  {
    title: 'what_are_your_hobbies',
  },
  {
    title: 'do_you_know_german',
  },
]
Run Code Online (Sandbox Code Playgroud)

我如何迭代这个数组并将其标题设置为如下状态:

state = {
  what_are_your_hobbies: '',
  do_you_know_german: ''
}
Run Code Online (Sandbox Code Playgroud)

javascript reactjs

1
推荐指数
1
解决办法
46
查看次数

React Native Semantic 问题:重新定义“MethodDescriptor”

该应用程序反应本机应用程序在模拟器上编译一切正常,但是当我尝试从 xcode 在我的 iphone 上运行它时,我收到以下错误:

语义问题:

1 - 'MethodDescriptor' 的重新定义 - 在路径/react-native/ReactCommon/cxxreact/ModuleRegistry.cpp:10 中包含的文件中:

2 - 'NativeModule' 的重新定义 - 1. 在 react-path/native/ReactCommon/cxxreact/ModuleRegistry.cpp:10 包含的文件中:

React-cxxreact/NativeModule.h 上的代码

// Copyright (c) Facebook, Inc. and its affiliates.

// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.

#pragma once

#include <string>
#include <vector>

#include <folly/Optional.h>
#include <folly/dynamic.h>

namespace facebook {
namespace react {

struct MethodDescriptor {
  std::string name;
  // type is …
Run Code Online (Sandbox Code Playgroud)

react-native react-native-ios

1
推荐指数
1
解决办法
1728
查看次数