How can I know if my data needs to be a react.js component?

I’m looking at React.js, and trying to see if it can help me with my recurring sets of data that I have on various pages. All the data is from a database, say a list of names and addresses, a tabular set of data, semantically tags.

I might need that set of information on more than one page. I’m using a PHP MVC framework (in-house), so I can call that data as needed, but I don’t know if I’m able to consider the set a “component.”

I don’t want overkill, but I might have lots of sets of data like that, and the data will be related (from some RDBMS). If I have a name and address, I may want to see how many orders I sent there. Is that orders set a component I can build? Examples could be multiplied.

Almost everything is from a form that is submitted and returns read only data. No inserts, updates or deletes, only select.

Is something like Angular.js a better suited framework? Overkill?

I had this on SO but deleted it. I think it is more of a design question.

If you’re getting some data, and you’re rendering that data, it’s a component. It’s as simple as that. Pretty much everything that renders should be a React component. Most other things do not want to be React components.

The React framework and lifecycle is completely built around “Render this data” as it’s pretty much sole purpose. If the responsibility of the code could be summarized that way, then it’s a component. Otherwise, it’s a poor fit for being a component.

2

Reusable components are the core of any React app. You can create a component for each type of data that you receive from the database and render them whenever the need arises. To decide how to break up components, refer to this post from Facebook.

As for the relation data you wish to work with, this is where the real design considerations might come in. If you are storing the data as props for each component, you will have to make sure that your design permits the top-bottom or bottom-top trickle of data or you may not be able to perform your relational queries. On the other hand you can store it as global or use any other approach you might deem right.

Another thing to be considered is that React is not a MVC framework so you cant task your Controller to store the data in Model and have the View work with it. In React you can either use the Isomorphic approach to get the data or you can make AJAX requests to your server. You should probably have a look at Flux Architecture for React.

As for using Angular, it’s a full fledged MVC framework while React’s chief concern is the View. It down to personal preferences.

Personally I use React whenever I need a ‘stateful’ web app. Where I need to handle view changes in real time based on user’s interactions with the app. React is best suited for this purpose, but if your app is going to be more of a static nature, you can definitely use React but you won’t be harnessing it’s full potential.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật