diff --git a/app/assets/javascripts/components/questionsView.js.jsx b/app/assets/javascripts/components/questionsView.js.jsx
new file mode 100644
index 0000000..2f493c5
--- /dev/null
+++ b/app/assets/javascripts/components/questionsView.js.jsx
@@ -0,0 +1,57 @@
+class QuestionView extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ questions: []
+ };
+ }
+
+ // componentDidMount() {
+ // this.fetchQuestions();
+ // }
+ //
+ // fetchQuestions() {
+ // $.ajax({
+ // url: '/questions',
+ // method: 'get',
+ // dataType: "json"
+ // })
+ // .done((response) => {
+ // this.setState({
+ // questions: response
+ // });
+ // });
+ // }
+
+ render() {
+ debugger
+ return (
+
+ );
+ }
+}
+
+function QuestionsList(props) {
+ return (
+
+
+ {props.questions.map(function(question, i) {
+ return
+ })}
+
+
+ )
+}
+
+function Question(props) {
+ return (
+
+
+ |
+ )
+}
diff --git a/app/controllers/questions_controller.rb b/app/controllers/questions_controller.rb
index 092db97..7cc1bc1 100644
--- a/app/controllers/questions_controller.rb
+++ b/app/controllers/questions_controller.rb
@@ -1,6 +1,10 @@
class QuestionsController < ApplicationController
def index
@questions = Question.all
+ render do |format|
+ format json: @questions, status: 200
+ format html: index.html.erb
+ end
end
def new
diff --git a/app/views/questions/index.html.erb b/app/views/questions/index.html.erb
index 818d386..53d2dca 100644
--- a/app/views/questions/index.html.erb
+++ b/app/views/questions/index.html.erb
@@ -1,27 +1,7 @@
-
-
Questions
-
-
-
-
-
+
+
+ <%= react_component('QuestionView', questions: Question.all.as_json(include: :author), prerender:true) %>
+
+