我最近开始做本地反应,并不理解如何调试,以便在控制台中获得我的结果.这是我在控制台中得到的结果.
Organizations is [object Object]
Run Code Online (Sandbox Code Playgroud)
我如何获得组织的所有内容.我在我的控制台代码中这样做了.
console.log('Organizations is '+organizations);
Run Code Online (Sandbox Code Playgroud) 我有一个 MaterialUI 的手风琴,其中我还添加了一些图标,但是单击这两个特定图标时,我不希望手风琴展开或折叠。我希望onClick点击时发生其他事件,但不展开或折叠。这是我正在使用的代码。
<ExpansionPanel>
<ExpansionPanelSummary expandIcon={<ExpandMoreIcon />}>
<Typography className={classes.heading}>
{name}
</Typography>
<ListItem>
<ListItemText />
<IconButton color="primary" aria-label="Edit" onClick={onClickEdit}>
<Edit />
</IconButton>
<IconButton onClick={onClickDelete} color="secondary" aria-label="Delete">
<Delete />
</IconButton>
</ListItem>
</ExpansionPanelSummary>
Run Code Online (Sandbox Code Playgroud)
对于单击两个图标,我不希望手风琴展开或折叠。这有关系吗?
我一直在尝试使用 mongodb 并插入一些数据,但出现错误。这是代码。
const MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://localhost:27017/TodoApp', (err, db) => {
if (err) {
return console.log('Unable to connect to MongoDB server');
}
console.log('Connected to MongoDB server');
db.collection('Users').insertOne({
name: 'Andrew',
age: 25,
location: 'Philadelphia'
}, (err, result) => {
if (err) {
return console.log('Unable to insert user', err);
}
console.log(result.ops);
});
db.close();
});
Run Code Online (Sandbox Code Playgroud) 作为新的反应本机,我真的无法弄清楚这是什么错误以及如何解决此错误.这是我正在处理的代码.
import React,{Component} from 'react';
import { StyleSheet, Text, View,TextInput ,Button,ListItem} from 'react-native';
export default class App extends React.Component {
state={
placename:'',
places:[]
}
placeholdername =val=>{
this.setState({
placename:val
})
};
submithandler =()=>{
console.log('Inside placesubmithandler');
this.setState(prevState => {
return {
places: prevState.places.concat(prevState.placename)
};
});
};
render() {
const placesOutput = this.state.places.map((place, i) => (
<ListItem key={i} placename={place} />
));
return (
<View style={styles.container}>
<View style={styles.inputcontainer}>
<TextInput
style={{width:300,borderColor:1,borderColor:"black"}}
placeholder="An awesome place"
value={this.state.placename}
onChangeText={this.placeholdername}
style={styles.placeButton}
/>
<Button
title="Add"
style={styles.placeButton}
onPress={this.submithandler}
/>
</View>
<View> …Run Code Online (Sandbox Code Playgroud) 我是 Spring Boot 的新手,刚刚开始探索它。我遇到了这个问题,其中 intellij ide 在 pom.xml 中显示此错误。我无法理解为什么会发生这种情况。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>Spring-boot-tutorial</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Spring-boot-tutorial</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.5.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.3</version>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
如果有人能够了解这些依赖关系问题在 …
javascript ×2
react-native ×2
java ×1
material-ui ×1
maven ×1
mongodb ×1
node.js ×1
object ×1
reactjs ×1
spring ×1
spring-boot ×1