S
S
seregindev2017-09-03 21:38:51
JavaScript
seregindev, 2017-09-03 21:38:51

Is it smart to blog with React?

Good day!
After sitting a little on the react, I wanted to create something interesting and complex. Create a blog.
And I want to achieve such an effect , the question is whether this is realizable in react?
As I understand it, we will simply change the state of the main component to the selected state, which will be loaded by AJAX.
If this is feasible, how bad is it for search?
If there are people who understand this ...
Thank you all for yelling

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikolai Dombrovsky, 2017-09-04
@seregindev

Yes, there is nothing complicated.
I am using react+redux.
Store "Articles" -> REST actions: request for a list of posts, request for a post (create/update/delete if necessary). Each event has a request/success/failure state. We just create 3 constants for each event:

const prefix = '@@ARTICLE/';

export const REQUEST = `${prefix}REQUEST`;
export const RECEIVE_SUCCESS = `${prefix}RECEIVE_SUCCESS`;
export const RECEIVE_FAILURE = `${prefix}RECEIVE_FAILURE`;

such a plan.
Smart components are "containers". We create to work with data, for a list, for example.
Stupid - "components". To display a display, for example, directly layout of the list.
That's all, when clicking on a post -> dispatch(LoadPost(postId)), where:
import { REQUEST, ... и другие нужные константы } from '../constants';
const LoadPost = postId => (dispatch) => {
 dispatch({ type: REQUEST, id: postId });
 fetch(куда нам надо)
   .then(r => r.json())
   .then((request) => {
      // обработка успеха
   })
   .catch((ex) => {
     // обработка ошибки
   })
}

Well, the animation is easy: transition to translate and opacity.
Good luck!

O
Oleg Gamega, 2017-09-03
@gadfi

maybe but why?
animation is still normal js/css - adding react (exactly like any other framework will only complicate the task)

M
Maxim Fedorov, 2017-09-03
@Maksclub

Do it, do it!
For search it doesn't matter if you do it well... pre-rendering and the content of the site and pages will be good

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question