🐈Reactでオブジェクト指向やってみる #状態管理ライブラリ一切不要2024/07/06に公開2024/08/044件JavaScriptReactTypeScriptオブジェクト指向ポリモーフィズムtechDiscussionllc_starhacks2024/07/08に更新お持ち帰り用Code: /** * @ref: https://zenn.dev/llc_starhacks/articles/929e58b503d6ce */ class ChatRoom extends Room {...} chatRoom.messages.create({ title, body, from: User, to: User }); chatRoom.messages[n].update({ title, body }); class PrivateChatRoom extends ChatRoom {...} privateChatRoom.messages[n].update({ title, body }); const data = await room.fetch(); privateChatRoom.delete(); const [name, setName] = useState('ハリー・ポッターと秘密の部屋'); const room = new Room({ name, setName }); room.name // stated variable room.setName('アズカバンの部屋'); 返信を追加Hidden comment
llc_starhacks2024/07/08に更新お持ち帰り用Code: /** * @ref: https://zenn.dev/llc_starhacks/articles/929e58b503d6ce */ class ChatRoom extends Room {...} chatRoom.messages.create({ title, body, from: User, to: User }); chatRoom.messages[n].update({ title, body }); class PrivateChatRoom extends ChatRoom {...} privateChatRoom.messages[n].update({ title, body }); const data = await room.fetch(); privateChatRoom.delete(); const [name, setName] = useState('ハリー・ポッターと秘密の部屋'); const room = new Room({ name, setName }); room.name // stated variable room.setName('アズカバンの部屋'); 返信を追加
Discussion
お持ち帰り用Code: