Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag

Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag

Hi,

I am writing simple reactjs application. Here is my code:

import React, { Component } from 'react';

class App extends Component {
  render() {
    return (

        <p>Hello world! Welcome!! React Tutorials.</p>
         <div id="parent">
            <h1>Header</h1>
            <h2>Content</h2>
            <p>This is the content!!!</p>
         </div>

    )
  }
}
export default App;

But it throws following error:

Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?

How to solve this?

Thanks

View Answers

March 16, 2020 at 12:14 AM

Hi,

This error is coming because you have not included he components in a starting and ending divs.

<div>....</div>

I have changed you code and following is running code:

import React, { Component } from 'react';

class App extends Component {
  render() {
    return (
        <div>
        <p>Hello world! Welcome!! React Tutorials.</p>
         <div id="parent">
            <h1>Header</h1>
            <h2>Content</h2>
            <p>This is the content!!!</p>
         </div>
         </div>
    )
  }
}
export default App;

Thanks









Related Tutorials/Questions & Answers:
Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag
Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag ... following error: Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? How to solve
Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag
Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag ... following error: Parsing error: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>? How to solve
Advertisements
Parsing repeatitive xml elements using SAX Parser - XML
Parsing repeatitive xml elements using SAX Parser  Hi, I'm using... only the value for the last tag is displayed. For example: Sachin Saurav... e){ System.out.println("XML File hasn't any elements
XML Parsing Error: mismatched tag. Expected: </br>. - JSP-Servlet
XML Parsing Error: mismatched tag. Expected: .  i had an error:"XML Parsing Error: mismatched tag. Expected: ." when uploading and writing them into an xml file. i use the jspBean to call the writeXML class. pls help me to solve
JSF convertNumber Tag
JSF convertNumber Tag          This tag is used to register the NumberConverter instance on the enclosing component. This class is responsible
ModuleNotFoundError: No module named 'jsx-lexer'
ModuleNotFoundError: No module named 'jsx-lexer'  Hi, My Python... 'jsx-lexer' How to remove the ModuleNotFoundError: No module named 'jsx... have to install padas library. You can install jsx-lexer python with following
ModuleNotFoundError: No module named 'jsx-lexer'
ModuleNotFoundError: No module named 'jsx-lexer'  Hi, My Python... 'jsx-lexer' How to remove the ModuleNotFoundError: No module named 'jsx... have to install padas library. You can install jsx-lexer python with following
ModuleNotFoundError: No module named 'sphinxcontrib-jsx'
ModuleNotFoundError: No module named 'sphinxcontrib-jsx'  Hi, My... named 'sphinxcontrib-jsx' How to remove the ModuleNotFoundError: No module named 'sphinxcontrib-jsx' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'sphinxcontrib-jsx'
ModuleNotFoundError: No module named 'sphinxcontrib-jsx'  Hi, My... named 'sphinxcontrib-jsx' How to remove the ModuleNotFoundError: No module named 'sphinxcontrib-jsx' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-jsx'
ModuleNotFoundError: No module named 'django-jsx'  Hi, My Python... 'django-jsx' How to remove the ModuleNotFoundError: No module named 'django-jsx' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'gears-jsx'
ModuleNotFoundError: No module named 'gears-jsx'  Hi, My Python... 'gears-jsx' How to remove the ModuleNotFoundError: No module named 'gears-jsx' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'jsx-lexer'
ModuleNotFoundError: No module named 'jsx-lexer'  Hi, My Python... 'jsx-lexer' How to remove the ModuleNotFoundError: No module named 'jsx... have to install padas library. You can install jsx-lexer python with following
JSF param Tag
JSF param Tag          This tag is used to set the parameter to the enclosing component. This tag is helpful in the case of  creating the compound message
ModuleNotFoundError: No module named 'wrapped-exception'
ModuleNotFoundError: No module named 'wrapped-exception'  Hi, My... named 'wrapped-exception' How to remove the ModuleNotFoundError: No module named 'wrapped-exception' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'wrapped-exception'
ModuleNotFoundError: No module named 'wrapped-exception'  Hi, My... named 'wrapped-exception' How to remove the ModuleNotFoundError: No module named 'wrapped-exception' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'wrapped-exception'
ModuleNotFoundError: No module named 'wrapped-exception'  Hi, My... named 'wrapped-exception' How to remove the ModuleNotFoundError: No module named 'wrapped-exception' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'wrapped-exception'
ModuleNotFoundError: No module named 'wrapped-exception'  Hi, My... named 'wrapped-exception' How to remove the ModuleNotFoundError: No module named 'wrapped-exception' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'wrapped-exception'
ModuleNotFoundError: No module named 'wrapped-exception'  Hi, My... named 'wrapped-exception' How to remove the ModuleNotFoundError: No module named 'wrapped-exception' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'wrapped-exception'
ModuleNotFoundError: No module named 'wrapped-exception'  Hi, My... named 'wrapped-exception' How to remove the ModuleNotFoundError: No module named 'wrapped-exception' error? Thanks   Hi, In your
JSF selectItems Tag
JSF selectItems Tag          This tag is used to add a set of items to the nearest enclosing parent (select one or select many) component. This tag can be used
parsing xml using sax
parsing xml using sax  how to get values if the root elements are same and their attributes are different
JSF converter Tag
JSF converter Tag          This tag is used to register the converter instance on the enclosing component. Many times it is required to convert the input
JSF actionListener Tag
JSF actionListener Tag          This tag is used to add a action listener to the component associated with the enclosing tag. When user does an event
ModuleNotFoundError: No module named 'redis_wrapped_mkstemp'
ModuleNotFoundError: No module named 'redis_wrapped_mkstemp'  Hi...: No module named 'redis_wrapped_mkstemp' How to remove the ModuleNotFoundError: No module named 'redis_wrapped_mkstemp' error? Thanks   Hi
Doubleselect Tag (Form Tag) Example
Doubleselect Tag (Form Tag) Example       In this section, we are going to describe the doubleselect tag. The doubleselect tag is a UI tag that renders two HTML select elements with second one
parsing word xml file using SAX parser - XML
parsing word xml file using SAX parser  i am parsing word 2003's XML file using SAX.here my question is,i want to write some tag elements which are between in other tag to a file. For ex
ModuleNotFoundError: No module named 'parsing'
ModuleNotFoundError: No module named 'parsing'  Hi, My Python... 'parsing' How to remove the ModuleNotFoundError: No module named 'parsing... to install padas library. You can install parsing python with following command
Struts2.2.1 updownselect Tag Example
Struts2.2.1 updownselect Tag Example The updownselect tag is a UI tag that creates a HTML select component with buttons to move up and down the elements in the select component. When the containing form is submitted, its elements
XML Elements
: Know-hows XML elements must follow these naming conventions: Names must... XML Elements       XML Elements are extensible. They have relationships. They have simple naming
parsing xml file in jsp
parsing xml file in jsp  example that pars XML file in JSP
XML parsing to Mysql database
XML parsing to Mysql database  Can someone please post the code for parsing an XML file into Mysql database using SAX
Tomahawk inputTextarea tag
Tomahawk inputTextarea tag          This tag is used to create... but it can take values in multiple lines which can be wrapped in different
Truncating issue while parsing XML with SAX Parser.
Truncating issue while parsing XML with SAX Parser.  I am Parsing one xml file and after parsing I have to enter the data into the database using hibernate. The problem is while parsing some elements, its not getting the complete
JSF valueChangeListener Tag
JSF valueChangeListener Tag          This tag is used to add a value change listener to the component associated with the enclosing tag. Value change event
parsing xml with jquery
parsing xml with jquery  Please explain how to parse a xml file into jquery. Thanks
ArrayList elements
ArrayList elements  how to print ArrayList elements in reverse order without using predefined methods   import java.util.*; class ArrayListReverse { public static void main(String[] args) { ArrayList
DTD-Elements
DTD-Elements       In a DTD, elements are declared with an ELEMENT declaration. Declaring Elements : syntaxADS_TO_REPLACE_1 In a DTD, XML elements are declared 
Parsing string in objective c
Parsing string in objective c  Hi, How can i parse a string in Objective c?? Thanks.   Parsing string in objective c This example will also help you to separate the strings separated by one component
Parsing date in Java
Parsing date in Java  How can i parse the date in Java in a simple format..?   SimpleDateFormat parserSDF=new SimpleDateFormat("EEE MMM d HH:mm:ss zzz yyyy
Parsing into date object
Parsing into date object  Here is my code: String de = (String) session.getAttribute("licvalid"); DateFormat df = new SimpleDateFormat("yyyy/MM/dd.... But, it is showing error at the line where i performed parsing operation. Please help me
Parsing into date object
Parsing into date object  Here is my code: String de = (String) session.getAttribute("licvalid"); DateFormat df = new SimpleDateFormat("yyyy/MM/dd.... But, it is showing error at the line where i performed parsing operation. Please help me
JSP Elements
elements : JSP Scriptlet element/tag : A scriptlet tag is denoted by the special...JSP Elements In this section we will learn about the JSP elements that we can use on a JSP page. This section will describe you all types of JSP elements
JSP Scripting Elements
JSP Scripting Elements  Explain the jsp scripting elements.   Hi, A scriplet tag is used to place a valid java code. This code is placed in the jspService() method by the JSP engine.ADS_TO_REPLACE_1 Thanks
Identify the interfaces and methods a CMP entity bean must and must not implement.
Identify the interfaces and methods a CMP entity bean must and must... the interfaces and methods a CMP entity bean must and must not implement. ... class: The class MUST implement
java parsing of data types
java parsing of data types  Why its not works? char ch; String s=* ch=Character.parseChar(s) program: char op; DataInputStream dis=new DataInputStream(System.in); System.out.print("Enter operator (+,-,*,/,%): "); op
xml document parsing
xml document parsing   Hi Guys, Xml document has been inserted into the database,how do i parse the xml document stored in database,so that xml document can be retrieved on to JSP file using jdbc/odbc connection. Please help me
Html Parsing Extracting Content
Html Parsing Extracting Content  Hello i need to parse html and search for a string and get its attributes.For example 'xxx' is my search string. i search html page and find xxx css attributes.Java,php,javascript is okey thank
xml parsing - XML
± how can i do this?   Hi friend, Parsing The XML File using DOM parser in JSP visit to : http://www.roseindia.net/jsp/parsing-xml.shtml
Empty Elements in HTML
Empty Elements in HTML  What is Empty Elements in HTML
How to make elements invisible ?
How to make elements invisible ?   How to make elements invisible

Ads