TypeError: _SchoolProduct__WEBPACK_IMPORTED_MODULE_2___default.a.map is not a functionReactjs Tutorial: Cannot read property 'props' of undefinedReactJS: TypeError: this.props.onGoogleSignIn is not a functionAboutHeader.jsx:21 Uncaught TypeError: this.setState is not a functionReact-redux tutorial : Where does children come fromCant get props after using map functionRedux - mapDispatchToProps - TypeError: _this.props.setCurrentUserHandle is not a functionReact Props not working, complete beginnerError when I was trying to render a map of itemsHow to fix “net::ERR_CONNECTION_REFUSED and Error: Network Error” error in Reactjs,Django,Django Rest Frame work projectError: The following params are required: Client ID, Client Secret on clarifai api on React

Talk interpreter

Why is the UK so keen to remove the "backstop" when their leadership seems to think that no border will be needed in Northern Ireland?

Breaker Mapping Questions

Removal of て in Japanese novels

Do Bayesian credible intervals treat the estimated parameter as a random variable?

How long do you think advanced cybernetic implants would plausibly last?

Papers on arXiv solving the same problem at the same time

Command "root" and "subcommands"

How do proponents of Sola Scriptura address the ministry of those Apostles who authored no parts of Scripture?

Prevent use of CNAME record for untrusted domain

How to check whether a sublist exist in a huge database lists in a fast way?

"Opusculum hoc, quamdiu vixero, doctioribus emendandum offero."?

What is the loud noise of a helicopter when the rotors are not yet moving?

Billiard balls collision

How were medieval castles built in swamps or marshes without draining them?

Are the players on the same team as the DM?

Changing JPEG to RAW to use on Lightroom?

The Wires Underground

Why doesn't 'd /= d' throw a division by zero exception?

Why do banks “park” their money at the European Central Bank?

When calculating a force, why do I get different result when I try to calculate via torque vs via sum of forces at an axis?

How can I unambiguously ask for a new user's "Display Name"?

What does "rel" in `mathrel` and `stackrel` stands for?

How many lines of code does the original TeX contain?



TypeError: _SchoolProduct__WEBPACK_IMPORTED_MODULE_2___default.a.map is not a function


Reactjs Tutorial: Cannot read property 'props' of undefinedReactJS: TypeError: this.props.onGoogleSignIn is not a functionAboutHeader.jsx:21 Uncaught TypeError: this.setState is not a functionReact-redux tutorial : Where does children come fromCant get props after using map functionRedux - mapDispatchToProps - TypeError: _this.props.setCurrentUserHandle is not a functionReact Props not working, complete beginnerError when I was trying to render a map of itemsHow to fix “net::ERR_CONNECTION_REFUSED and Error: Network Error” error in Reactjs,Django,Django Rest Frame work projectError: The following params are required: Client ID, Client Secret on clarifai api on React






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I am new at ReactJs and try to complete a task from the youtube channel.
I created array "products" in "SchoolProduct.js" then using props I passed the value in Product.js.
Now in App.js, I used map function to get data
(Maybe I understand something wrong about props or map function)



Here is SchoolProduct.js:



 const products = [

id: "1",
name: "pencil",
price: 1,
description: "this is pencil"
,

id: "2",
name: "rubber",
price: 10,
description: "this is rubber"


]


this is my Product.js



import React from "react"
function Product(props)

return
(
<div>
<h2>props.product.name</h2>
<p>props.product.price.toLocaleString("en-US", style: "currency",
currency: "USD")
- props.product.description</p>
</div>
)



export default Product


and this my App.js



import React, Component from 'react';
import Product from "./Product"
import productsData from "./SchoolProduct"


function App()

const productsComponents = productsData.map(item => <Product product=
item/>)

return (
<div>
productsComponents
</div>
)


export default App;


The Error is:
TypeError: _SchoolProduct__WEBPACK_IMPORTED_MODULE_2___default.a.map is not a function



its shows error in App.js line no 8, which is "const productsComponents"



I know I create a silly mistake, but I am trying to improve it










share|improve this question
























  • You need to export the array in SchoolProduct, export const products = [

    – Phix
    Mar 27 at 19:11











  • @Phix now it shows "Attempted import error: './SchoolProduct' does not contain a default export (imported as 'productsData')."

    – Sagar Parikh SGR
    Mar 28 at 3:36

















0















I am new at ReactJs and try to complete a task from the youtube channel.
I created array "products" in "SchoolProduct.js" then using props I passed the value in Product.js.
Now in App.js, I used map function to get data
(Maybe I understand something wrong about props or map function)



Here is SchoolProduct.js:



 const products = [

id: "1",
name: "pencil",
price: 1,
description: "this is pencil"
,

id: "2",
name: "rubber",
price: 10,
description: "this is rubber"


]


this is my Product.js



import React from "react"
function Product(props)

return
(
<div>
<h2>props.product.name</h2>
<p>props.product.price.toLocaleString("en-US", style: "currency",
currency: "USD")
- props.product.description</p>
</div>
)



export default Product


and this my App.js



import React, Component from 'react';
import Product from "./Product"
import productsData from "./SchoolProduct"


function App()

const productsComponents = productsData.map(item => <Product product=
item/>)

return (
<div>
productsComponents
</div>
)


export default App;


The Error is:
TypeError: _SchoolProduct__WEBPACK_IMPORTED_MODULE_2___default.a.map is not a function



its shows error in App.js line no 8, which is "const productsComponents"



I know I create a silly mistake, but I am trying to improve it










share|improve this question
























  • You need to export the array in SchoolProduct, export const products = [

    – Phix
    Mar 27 at 19:11











  • @Phix now it shows "Attempted import error: './SchoolProduct' does not contain a default export (imported as 'productsData')."

    – Sagar Parikh SGR
    Mar 28 at 3:36













0












0








0








I am new at ReactJs and try to complete a task from the youtube channel.
I created array "products" in "SchoolProduct.js" then using props I passed the value in Product.js.
Now in App.js, I used map function to get data
(Maybe I understand something wrong about props or map function)



Here is SchoolProduct.js:



 const products = [

id: "1",
name: "pencil",
price: 1,
description: "this is pencil"
,

id: "2",
name: "rubber",
price: 10,
description: "this is rubber"


]


this is my Product.js



import React from "react"
function Product(props)

return
(
<div>
<h2>props.product.name</h2>
<p>props.product.price.toLocaleString("en-US", style: "currency",
currency: "USD")
- props.product.description</p>
</div>
)



export default Product


and this my App.js



import React, Component from 'react';
import Product from "./Product"
import productsData from "./SchoolProduct"


function App()

const productsComponents = productsData.map(item => <Product product=
item/>)

return (
<div>
productsComponents
</div>
)


export default App;


The Error is:
TypeError: _SchoolProduct__WEBPACK_IMPORTED_MODULE_2___default.a.map is not a function



its shows error in App.js line no 8, which is "const productsComponents"



I know I create a silly mistake, but I am trying to improve it










share|improve this question














I am new at ReactJs and try to complete a task from the youtube channel.
I created array "products" in "SchoolProduct.js" then using props I passed the value in Product.js.
Now in App.js, I used map function to get data
(Maybe I understand something wrong about props or map function)



Here is SchoolProduct.js:



 const products = [

id: "1",
name: "pencil",
price: 1,
description: "this is pencil"
,

id: "2",
name: "rubber",
price: 10,
description: "this is rubber"


]


this is my Product.js



import React from "react"
function Product(props)

return
(
<div>
<h2>props.product.name</h2>
<p>props.product.price.toLocaleString("en-US", style: "currency",
currency: "USD")
- props.product.description</p>
</div>
)



export default Product


and this my App.js



import React, Component from 'react';
import Product from "./Product"
import productsData from "./SchoolProduct"


function App()

const productsComponents = productsData.map(item => <Product product=
item/>)

return (
<div>
productsComponents
</div>
)


export default App;


The Error is:
TypeError: _SchoolProduct__WEBPACK_IMPORTED_MODULE_2___default.a.map is not a function



its shows error in App.js line no 8, which is "const productsComponents"



I know I create a silly mistake, but I am trying to improve it







reactjs typeerror react-props






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 18:38









Sagar Parikh SGRSagar Parikh SGR

677 bronze badges




677 bronze badges















  • You need to export the array in SchoolProduct, export const products = [

    – Phix
    Mar 27 at 19:11











  • @Phix now it shows "Attempted import error: './SchoolProduct' does not contain a default export (imported as 'productsData')."

    – Sagar Parikh SGR
    Mar 28 at 3:36

















  • You need to export the array in SchoolProduct, export const products = [

    – Phix
    Mar 27 at 19:11











  • @Phix now it shows "Attempted import error: './SchoolProduct' does not contain a default export (imported as 'productsData')."

    – Sagar Parikh SGR
    Mar 28 at 3:36
















You need to export the array in SchoolProduct, export const products = [

– Phix
Mar 27 at 19:11





You need to export the array in SchoolProduct, export const products = [

– Phix
Mar 27 at 19:11













@Phix now it shows "Attempted import error: './SchoolProduct' does not contain a default export (imported as 'productsData')."

– Sagar Parikh SGR
Mar 28 at 3:36





@Phix now it shows "Attempted import error: './SchoolProduct' does not contain a default export (imported as 'productsData')."

– Sagar Parikh SGR
Mar 28 at 3:36












1 Answer
1






active

oldest

votes


















0















I have to export my error in default way,



const products = [

id: "1",
name: "pencil",
price: 1,
description: "this is pencil"
,

id: "2",
name: "rubber",
price: 10,
description: "this is rubber"

]
export default products





share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384383%2ftypeerror-schoolproduct-webpack-imported-module-2-default-a-map-is-not-a-fu%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0















    I have to export my error in default way,



    const products = [

    id: "1",
    name: "pencil",
    price: 1,
    description: "this is pencil"
    ,

    id: "2",
    name: "rubber",
    price: 10,
    description: "this is rubber"

    ]
    export default products





    share|improve this answer





























      0















      I have to export my error in default way,



      const products = [

      id: "1",
      name: "pencil",
      price: 1,
      description: "this is pencil"
      ,

      id: "2",
      name: "rubber",
      price: 10,
      description: "this is rubber"

      ]
      export default products





      share|improve this answer



























        0














        0










        0









        I have to export my error in default way,



        const products = [

        id: "1",
        name: "pencil",
        price: 1,
        description: "this is pencil"
        ,

        id: "2",
        name: "rubber",
        price: 10,
        description: "this is rubber"

        ]
        export default products





        share|improve this answer













        I have to export my error in default way,



        const products = [

        id: "1",
        name: "pencil",
        price: 1,
        description: "this is pencil"
        ,

        id: "2",
        name: "rubber",
        price: 10,
        description: "this is rubber"

        ]
        export default products






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 3:44









        Sagar Parikh SGRSagar Parikh SGR

        677 bronze badges




        677 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55384383%2ftypeerror-schoolproduct-webpack-imported-module-2-default-a-map-is-not-a-fu%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript