An interesting ant-design interaction with backend data

Source: Internet
Author: User

Recently, news are sorted by time and clicks. News stored in the database are sorted by time order. Data is retrieved from the background data and displayed on the front-end page.
I used the tabs switch page in ant-design. The style is like.

In fact, the most gratifying thing about this project is the encapsulation of the reducer middleware, which does not need to request data through fetch. Instead, it uses another method of encapsulating the middleware.
Of course, Redux-thunk is referenced in the store.

The project uses three request methods first.




These three methods are used in middleware and callapi is encapsulated.






We write the method in action, and callapi is the data at the backend of the request.

! [] (Https://img2018.cnblogs.com/blog/1037363/201810/1037363-20181030215504862-1545352272.png)

In our CER, we expose the data through type and return our request results.

Do not forget to merge our CER Method

! [] (Https://img2018.cnblogs.com/blog/1037363/201810/1037363-20181030215844812-1960971869.png)

Do not forget to use these methods in our files.

! [] (Https://img2018.cnblogs.com/blog/1037363/201810/1037363-20181030220118887-1234711062.png)

Let's talk about the methods I used in this data.
GET request data through map and es7 decorators syntax

How to find the values?


What we want is to display the latest 5 News


Next, click the details event to go to the details page.

An interesting ant-design interaction with backend data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.