Skip to content

Instantly share code, notes, and snippets.

@Jpoliachik
Last active January 9, 2024 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jpoliachik/41c6033a3405a00d8c69cc0f2c02edcd to your computer and use it in GitHub Desktop.
Save Jpoliachik/41c6033a3405a00d8c69cc0f2c02edcd to your computer and use it in GitHub Desktop.
Ignite Trivia App
...
import shuffle from "lodash.shuffle"
...
...
export const QuestionModel = types
...
.views((self) => ({
get allAnswers() {
return shuffle([
...self.incorrectAnswers,
...(self.correctAnswer ? [self.correctAnswer] : []),
])
},
}))
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment