The landing page composed of the Register/Login component and about content in addition to Header and Footer components. The Login and Register components are two separate components which will be slide on and off based on the user interaction.
Once the user logged in it will take them to the home page which contains an option too ask a question and the questions asked so far by the community. A separate component called AllQuestions, which fetches and render all questions from the backend server, is created and used in this home page.
When a single question is clicked from the home page it will take us to this page which has the selected single question and corrsponding answes if any to that question. To fetch the selected question and its answer, fetchAnswers and fetchQuestion functions used as shown below. After fetched the result from the backend server, rendering will be completed.
The backend has an API end point which fetches a single question from the database. Select the question using the question id, which passed to this api endpoint as a query param from the front end, and return the result.
The backend has an API end point which fetches answers for a specific question from the database. Select answers using the question id, which passed to this api endpoint as a query param from the front end, and join users table to get the user who answered this question and finally return the result.