This content originally appeared on DEV Community and was authored by Annie Zheng
tl;dr How should I approach storing code blocks in a react + rail application? If I were to store the code block data in the rails backend, which datatype should I store it as? And if on the frontend, would mdx files be the best solution?
I’m building a programming quiz application where a question has many answers and each answer (only one is correct) has an explanation. The question consists of the question itself and a code block, similar to what’s circled in orange in the following image:
As I want to practice building Rails+React (Next.js) applications, I thought that the questions would be stored on the backend. However, is that a good idea? If so, I’m wondering about what would be a possible way to store the code snippets given the Rails datatypes?
Alternatively, I was also considering storing all the questions on the frontend. If I choose to do so, would mdx files be the best solution here?
So, to sum up, which of the following solutions would be best here:
- Storing code block as markdown files in the frontend
- Storing code block data in the backend
- Different solution altogether?
This content originally appeared on DEV Community and was authored by Annie Zheng
Annie Zheng | Sciencx (2021-06-07T02:25:11+00:00) Advice Needed ➡️ Rails+React/Next.js: how to store code blocks so formatting persists?. Retrieved from https://www.scien.cx/2021/06/07/advice-needed-%e2%9e%a1%ef%b8%8f-railsreact-next-js-how-to-store-code-blocks-so-formatting-persists/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.