如何解决我创建了一个自定义的 Odoo 模块,当我想升级它时它显示解析错误
这是我收到的错误消息。
In React you should understand the difference between a functional component and class component. Hooks have been introduced in react 16.8 to compensate the lack of state maganement (useState),lifeCycle (ComponentWillMount,ComponentDidMount,...etc) in Functional component.
So every time you are trying to use a hook make sure you have declare a functional Component instead of a class.
P.S: a functionnal component is a pure Javascript function.
So you had 2 ways to implement your Component App
1)- As a functional Component
import React,{useState} from 'react';
const App =(props)=> { //if you are planning to use any props
const [textInput,setTextInput] = useState("");
const [tweets,setTweets] = useState([]);
const name = "SomeNameJohnDoe";
return (
<div>
<h1>Hello React learners!</h1>
<CreateTweet
textInput={textInput}
setTextInput={setTextInput}
tweets={tweets}
setTweets={setTweets}
/>
<TweetList name={name} tweets={tweets}/>
</div>
);
}
2)- As a class Component.
import React from 'react';
const name = "SomeNameJohnDoe";
class App extends Component {
state = {
textInput: "",tweets: ""
}
setTextInput = (input) =>{
this.setState({textInput:input});
}
setTweets = (tweet) =>{
this.setState({tweets:tweet});
}
render() {
return(
<div>
<h1>Hello React learners!</h1>
<CreateTweet
textInput={this.state.textInput}
setTextInput={this.setTextInput}
tweets={this.state.tweets}
setTweets={this.setTweets}
/>
<TweetList name={name} tweets={this.state.tweets}/>
</div>
);
}
}
解决方法
字段 view_type
在最新的 Odoo 版本之一中被删除。只需将其从您的操作定义中删除即可。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。