我正在使用react native。我需要定義一個類:react-native:如何定義一個javascript類
class myClass {
email: string;
name: string;
constructor() {
setUser(fbid: string, token: string): boolean {
我試圖在它自己的文件myClass.js來定義它,當我有它在我的index.ios.js,我得到這個錯誤:
Can't find variable: myClass
您可以請我指點關於如何定義非反應類並在反應原生中使用它們的任何文檔?謝謝你的閱讀。
我對reactjs不熟悉,但是如果你想在JS中創建一個類,這應該會有所幫助,特別是'Custom objects'部分:https://developer.mozilla.org/en-US/docs/ Web/JavaScript/Introduction_to_Object-Oriented_JavaScript –
[ReactJS](https://facebook.github.io/react/)是一個JavaScript庫。 [React Native](https://facebook.github.io/react-native/)是一個移動框架,不要把它們誤認爲是同一件事。 – ArthurG