Last active
July 1, 2020 20:22
-
-
Save guillaumewuip/ede444721da0410c7191c7e5e4ca9984 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as Message from ‘../path/to/message.ts’; | |
const message: Message = Message.createText({ text: ‘hello world’ }); | |
if (Message.isText(message)) { | |
return <p>This is a text</p>; | |
} else { | |
return <p>This is an image</p>; | |
} | |
// or | |
return fold({ | |
Text: () => <p>This is a text</p>, | |
Image: () => <p>This is an image</p>, | |
})(message) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment