Hướng dẫn remove html tag react native - xóa thẻ html phản ứng gốc

Trong ứng dụng gốc React của tôi, tôi đang tìm nạp dữ liệu JSON có chứa thẻ HTML thô. Làm thế nào để xóa các thẻ HTML khỏi đó?

[{
    "data": {
        "course": {
            "id": 2864,
            "name": "2. Understanding India’s economic transition",
            "date_created": 1506154480,
            "status": "publish",
            "price": false,
            "price_html": "FREE",
            "total_students": 0,
            "seats": "",
            "start_date": false,
            "average_rating": 0,
            "rating_count": 0,
            "featured_image": "https://www.mywebsite.com/lms/wp-content/themes/wplms/assets/images/avatar.jpg",
            "categories": [],
            "instructor": {
                "id": "22",
                "name": "aami",
                "avatar": "https://www.mywebsite.com/lms/wp-content/uploads/2017/11/favicon.png",
                "sub": ""
            },
            "menu_order": 0
        },
        "description": "

India is undergoing an economic, social and technological transformation. Perhaps no other phase is going to be as critical as the present one in shaping the future of the country as well as determining the welfare of the people. The economic transition is the vital ingredient of these overall change. Faster growth accompanied by industrial sector expansion, skill addition to the people, creation of quality infrastructure etc. will fuel this growth phase.

\n

For understanding how important is the present development phase, we have to adopt a historical and comparative study. Following factors helps us to understand the present development phase of India.

\n\n
    \n \t
  1. Achievement of higher growth rate as a middle-income economy.
  2. \n
\n

India at present is a lower middle-income economy and has to become a high-income economy undergoing a rapid growth phase extending at least three decades.

\n

Most important narrative about the Indian economy is that it is the third largest in the world in terms of Purchasing Power Parity GDP. But a superior way to asses a country’s development is to consider per capita income. The widely used ranking about countries’ economic position is that of the World Bank’s GDP Per capita (constant US $) and the data for 2016 shows that India’s per capita income is $1861 compared to China’s $ 6994.

\n

Table: Categorization of countries by World Bank

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
CategoryPCI as on 2015 in constant US Dollar
Low Income Economy$ 1025 or less
Middle Income Economy\n\n(India - $ 1861)$1026 to $4035 (Lower Middle Income)\n\n$4036 to $12475 (Upper Middle Income)
Higher Income Economy$ 12476 and above
\n

According to World Bank metrics, a country with less than $1045 is considered as low-income economy whereas one with a PCI of $12736 or higher is considered as a higher income economy. Higher income means higher standard of living. India is at the bottom of the lower middle-income economies and has to achieve higher economic growth, structural changes including industrialisation to raise per capita income near to the $12736 mark in the long run. This is what the country has to achieve through the transition.

\n\n
    \n \t
  1. Industrial sector expansion
  2. \n
\n

There are several factors that drives the economy to prosperity. Per capita income is just a monitored goal. How it can be raised is through achieving more productivity and employment generation in the sectors that can create big changes is decisive element for the country’s transition. Here comes the role of industrial sector. The industrial sector is known for generating huge employment with minimum skill addition. Similarly, no other sector has higher level of tradability as the industrial sector (means a country can earn big income through exports). Graduating to an expanded services sector without undergoing industrialisation will be self-defeating and unsuitable to a big economy like India. Depending on services sector for exports will not reward as other countries like to protect their services sector from the inflow of India’s skilled persons. If India can increase the contribution of the industrial sector in GDP from the present 30 per cent to say 40-45%, it implies that sizable income and employment are created in the sector.

\n\n
    \n \t
  1. Skilling the people when demography favours.
  2. \n
\n

India has the largest number of young people in the world besides having largest workforce age group population. This situation is expected to remain till 2045. Now, youth means higher ability to produce, consume and thus stimulate overall economic activities. As in the case of an individual, better things happen for an economy when it is young.

\n\n
    \n \t
  1. Infrastructure generation.
  2. \n
\n

Infrastructure is the platform for fueling growth. The government has launched several programmes to build quality infrastructure to assist economic transformation. In the industrial sector, there is the industrial corridor project; in transportation – there is the NHDP, PMGSY, Bhartamala, Sagarmala etc. Similarly, digital infrastructure is undergoing a qualitative improvement along with the education sector.

\n\n
    \n \t
  1. Building invention and Innovation.
  2. \n
\n

Development is dynamic and present day developing economies can’t achieve development with the strategy of the past. Fourth industrialisation, robotics, artificial intelligence etc., proved that industrialisation is not labour oriented. Here, Countries like China with the aid of superior technology with its sizable labour force can produce and supply goods to the entire world. Competing in the new age industrial sector need good technological adaptation and a progressive national invention and educational systems.

\n\n
    \n \t
  1. Easing of Doing Business.
  2. \n
\n

India’s business environment is historically suffocated by excess regulations and slow bureaucratic functions that are unsuitable for enterprise development.. But in recent years, institutional reforms are taking place and development blocking regulations are in the process of elimination.

\n

Development has become a major theme of the government and every issue related with economic prosperity are sophisticatedly addressed. Improvements in all the above field is slowly yielding results. Despite the adverse global slowdown and anti-globalisation headwinds, India continues to be the fastest growing large economy.

", "curriculum": false, "reviews": [], "instructors": [{ "id": "22", "name": "tojo", "avatar": "https://www.mywebsite.com/lms/wp-content/uploads/2017/11/favicon.png", "sub": "", "average_rating": 0, "student_count": 0, "course_count": "0", "bio": false }], "purchase_link": false }, "headers": [], "status": 200 }]

Tôi đang liệt kê description bên trong thẻ.Vậy làm thế nào để xóa thẻ HTML? Xin hãy giúp đỡ..có cách làm điều này không?

Làm thế nào loại bỏ thẻ HTML khỏi chuỗi phản ứng tự nhiên?

// Xóa thẻ HTML khỏi chuỗi, chỉ để lại hàm văn bản bên trong RemoveHtml (str) {var tmp = document.createelement ("div");tmp.innerhtml = str;Trả về TMP.TextContent ||TMP.removeHTML(str){ var tmp = document. createElement("DIV"); tmp. innerHTML = str; return tmp. textContent || tmp.

Làm thế nào loại bỏ tất cả các thẻ HTML khỏi chuỗi trong React JS?

Để loại bỏ tất cả các thẻ HTML từ một chuỗi, có rất nhiều thủ tục trong JavaScript.Để loại bỏ các thẻ, chúng tôi có thể sử dụng hàm thay thế () và cũng có thể sử dụng thuộc tính .textContent, .innertext thuộc tính từ HTML DOM.use replace() function and can also use . textContent property, . innerText property from HTML DOM.