TypeError: Cannot read property 'baseVal' of undefinedReact - uncaught TypeError: Cannot read property 'setState' of undefinedTypeError: Cannot read property 'contextTypes' of undefinedTypeError: Cannot read property 'equal' of undefinedReact-redux - Cannot read property 'map' of undefinedcannot read property history because it's undefined but it isHow to render the component from property of object?Jest/Enzyme Class Component testing with React Suspense and React.lazy child componentSpecificity issue with conditional rendering of list items in React & SCSSError: The following params are required: Client ID, Client Secret on clarifai api on ReactComponent returned in map function will not render

Was 'help' pronounced starting with a vowel sound?

Is it allowable to use an organization's name to publish a paper in a conference, even after I graduate from it?

In an emergency, how do I find and share my position?

How do you call it when two celestial bodies come as close to each other as they will in their current orbits?

Can I submit a paper under an alias so as to avoid trouble in my country?

Why would the US President need briefings on UFOs?

Is there a SubImageApply?

What are the pros and cons of Einstein-Cartan Theory?

How to organize ideas to start writing a novel?

Is there such a thing as too inconvenient?

How to decide whether an eshop is safe or compromised

Why is 日本 read as "nihon" but not "nitsuhon"?

Is it appropriate for a business to ask me for my credit report?

How big would a Daddy Longlegs Spider need to be to kill an average Human?

Does Swashbuckler's Fancy Footwork apply if the attack was made with Booming Blade?

Why didn’t Doctor Strange stay in the original winning timeline?

Ruling for Grappling a Creature Underwater While you are on Land?

Expressing a chain of boolean ORs using ILP involving different variables

Sleeping solo in a double sleeping bag

Why is Boris Johnson visiting only Paris & Berlin if every member of the EU needs to agree on a withdrawal deal?

How can I support the recycling, but not the new production of aluminum?

Changing a TGV booking

How does turbine efficiency compare with internal combustion engines if all the turbine power is converted to mechanical energy?

Is "stainless" a bulk or a surface property of stainless steel?



TypeError: Cannot read property 'baseVal' of undefined


React - uncaught TypeError: Cannot read property 'setState' of undefinedTypeError: Cannot read property 'contextTypes' of undefinedTypeError: Cannot read property 'equal' of undefinedReact-redux - Cannot read property 'map' of undefinedcannot read property history because it's undefined but it isHow to render the component from property of object?Jest/Enzyme Class Component testing with React Suspense and React.lazy child componentSpecificity issue with conditional rendering of list items in React & SCSSError: The following params are required: Client ID, Client Secret on clarifai api on ReactComponent returned in map function will not render






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








2















I am unit testing my react component using renderer of react-test-renderer. it was working fine, but after using ReactCssTransitionGroup I am getting the following error "TypeError: Cannot read property 'baseVal' of undefined". not sure how to resolve this issue



I verified this issue is caused by ReactCssTransitionGroup



Below is my component file:



import React from 'react';
import PropTypes from 'prop-types';
import List, ListItem, Spinner from '@stores/reactCommon';
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';

import BagListItem from './bag-list-item';

const BagList = (bagList, loading) =>
const items = bagList.map((item, key) => (
<ListItem key=key>
<BagListItem
upc=item.upc
price=item.sellingPrice
description=item.description
/>
</ListItem>
));
return (
<div className="bag-list">
loading ? (
<span className="bag-list__spinner">
<Spinner size="extra-large" />
</span>
) : null
<div className="bag-list__story-default-spacer">
<List maxHeight="70vh">
<ReactCSSTransitionGroup
transitionName="bagList"
transitionAppear=true
transitionAppearTimeout=500
transitionEnterTimeout=500
transitionLeaveTimeout=300
>
items
</ReactCSSTransitionGroup>
</List>
</div>
</div>
);
;

BagList.propTypes =
bagList: PropTypes.array.isRequired,
loading: PropTypes.bool
;

export default BagList;



Below is my unit test file



import React from 'react';
import renderer from 'react-test-renderer';
import BagList from '../../../../src/client/js/components/bag-list/bag-list';

describe('<BagList />', function()
this.items = [

upc: '123222123',
sellingPrice: '12',
description: 'this is a description'
,

upc: '555123',
price: '23',
description: 'this is a description'

];
this.getComponent = items =>
return <BagList bagList=items loading=false />;
;

it('Should render <BagList /> with bagList', () =>
// this line is generating the error
const items = renderer.create(this.getComponent(this.items)).toJSON();
expect(items).toMatchSnapshot();
);
);










share|improve this question





















  • 2





    can you either paste the full stack trace, or paste the piece of code where you read myObj.baseVal ?

    – Christopher Francisco
    Mar 27 at 15:30

















2















I am unit testing my react component using renderer of react-test-renderer. it was working fine, but after using ReactCssTransitionGroup I am getting the following error "TypeError: Cannot read property 'baseVal' of undefined". not sure how to resolve this issue



I verified this issue is caused by ReactCssTransitionGroup



Below is my component file:



import React from 'react';
import PropTypes from 'prop-types';
import List, ListItem, Spinner from '@stores/reactCommon';
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';

import BagListItem from './bag-list-item';

const BagList = (bagList, loading) =>
const items = bagList.map((item, key) => (
<ListItem key=key>
<BagListItem
upc=item.upc
price=item.sellingPrice
description=item.description
/>
</ListItem>
));
return (
<div className="bag-list">
loading ? (
<span className="bag-list__spinner">
<Spinner size="extra-large" />
</span>
) : null
<div className="bag-list__story-default-spacer">
<List maxHeight="70vh">
<ReactCSSTransitionGroup
transitionName="bagList"
transitionAppear=true
transitionAppearTimeout=500
transitionEnterTimeout=500
transitionLeaveTimeout=300
>
items
</ReactCSSTransitionGroup>
</List>
</div>
</div>
);
;

BagList.propTypes =
bagList: PropTypes.array.isRequired,
loading: PropTypes.bool
;

export default BagList;



Below is my unit test file



import React from 'react';
import renderer from 'react-test-renderer';
import BagList from '../../../../src/client/js/components/bag-list/bag-list';

describe('<BagList />', function()
this.items = [

upc: '123222123',
sellingPrice: '12',
description: 'this is a description'
,

upc: '555123',
price: '23',
description: 'this is a description'

];
this.getComponent = items =>
return <BagList bagList=items loading=false />;
;

it('Should render <BagList /> with bagList', () =>
// this line is generating the error
const items = renderer.create(this.getComponent(this.items)).toJSON();
expect(items).toMatchSnapshot();
);
);










share|improve this question





















  • 2





    can you either paste the full stack trace, or paste the piece of code where you read myObj.baseVal ?

    – Christopher Francisco
    Mar 27 at 15:30













2












2








2








I am unit testing my react component using renderer of react-test-renderer. it was working fine, but after using ReactCssTransitionGroup I am getting the following error "TypeError: Cannot read property 'baseVal' of undefined". not sure how to resolve this issue



I verified this issue is caused by ReactCssTransitionGroup



Below is my component file:



import React from 'react';
import PropTypes from 'prop-types';
import List, ListItem, Spinner from '@stores/reactCommon';
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';

import BagListItem from './bag-list-item';

const BagList = (bagList, loading) =>
const items = bagList.map((item, key) => (
<ListItem key=key>
<BagListItem
upc=item.upc
price=item.sellingPrice
description=item.description
/>
</ListItem>
));
return (
<div className="bag-list">
loading ? (
<span className="bag-list__spinner">
<Spinner size="extra-large" />
</span>
) : null
<div className="bag-list__story-default-spacer">
<List maxHeight="70vh">
<ReactCSSTransitionGroup
transitionName="bagList"
transitionAppear=true
transitionAppearTimeout=500
transitionEnterTimeout=500
transitionLeaveTimeout=300
>
items
</ReactCSSTransitionGroup>
</List>
</div>
</div>
);
;

BagList.propTypes =
bagList: PropTypes.array.isRequired,
loading: PropTypes.bool
;

export default BagList;



Below is my unit test file



import React from 'react';
import renderer from 'react-test-renderer';
import BagList from '../../../../src/client/js/components/bag-list/bag-list';

describe('<BagList />', function()
this.items = [

upc: '123222123',
sellingPrice: '12',
description: 'this is a description'
,

upc: '555123',
price: '23',
description: 'this is a description'

];
this.getComponent = items =>
return <BagList bagList=items loading=false />;
;

it('Should render <BagList /> with bagList', () =>
// this line is generating the error
const items = renderer.create(this.getComponent(this.items)).toJSON();
expect(items).toMatchSnapshot();
);
);










share|improve this question
















I am unit testing my react component using renderer of react-test-renderer. it was working fine, but after using ReactCssTransitionGroup I am getting the following error "TypeError: Cannot read property 'baseVal' of undefined". not sure how to resolve this issue



I verified this issue is caused by ReactCssTransitionGroup



Below is my component file:



import React from 'react';
import PropTypes from 'prop-types';
import List, ListItem, Spinner from '@stores/reactCommon';
import ReactCSSTransitionGroup from 'react-addons-css-transition-group';

import BagListItem from './bag-list-item';

const BagList = (bagList, loading) =>
const items = bagList.map((item, key) => (
<ListItem key=key>
<BagListItem
upc=item.upc
price=item.sellingPrice
description=item.description
/>
</ListItem>
));
return (
<div className="bag-list">
loading ? (
<span className="bag-list__spinner">
<Spinner size="extra-large" />
</span>
) : null
<div className="bag-list__story-default-spacer">
<List maxHeight="70vh">
<ReactCSSTransitionGroup
transitionName="bagList"
transitionAppear=true
transitionAppearTimeout=500
transitionEnterTimeout=500
transitionLeaveTimeout=300
>
items
</ReactCSSTransitionGroup>
</List>
</div>
</div>
);
;

BagList.propTypes =
bagList: PropTypes.array.isRequired,
loading: PropTypes.bool
;

export default BagList;



Below is my unit test file



import React from 'react';
import renderer from 'react-test-renderer';
import BagList from '../../../../src/client/js/components/bag-list/bag-list';

describe('<BagList />', function()
this.items = [

upc: '123222123',
sellingPrice: '12',
description: 'this is a description'
,

upc: '555123',
price: '23',
description: 'this is a description'

];
this.getComponent = items =>
return <BagList bagList=items loading=false />;
;

it('Should render <BagList /> with bagList', () =>
// this line is generating the error
const items = renderer.create(this.getComponent(this.items)).toJSON();
expect(items).toMatchSnapshot();
);
);







reactjs unit-testing jestjs reactcsstransitiongroup react-test-renderer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 5 at 8:11









skyboyer

6,1671 gold badge16 silver badges37 bronze badges




6,1671 gold badge16 silver badges37 bronze badges










asked Mar 27 at 15:28









Hammad TariqHammad Tariq

745 bronze badges




745 bronze badges










  • 2





    can you either paste the full stack trace, or paste the piece of code where you read myObj.baseVal ?

    – Christopher Francisco
    Mar 27 at 15:30












  • 2





    can you either paste the full stack trace, or paste the piece of code where you read myObj.baseVal ?

    – Christopher Francisco
    Mar 27 at 15:30







2




2





can you either paste the full stack trace, or paste the piece of code where you read myObj.baseVal ?

– Christopher Francisco
Mar 27 at 15:30





can you either paste the full stack trace, or paste the piece of code where you read myObj.baseVal ?

– Christopher Francisco
Mar 27 at 15:30












1 Answer
1






active

oldest

votes


















2














react-addons-css-transition-group is an old package that was deprecated in favor of react-transition-group.



v1 of react-transition-group was a drop-in replacement, but it was rewritten in v2.



You'll probably want to move to CSSTransition from the latest react-transition-group.




Having said that, the error is coming from this code:



function hasClass(element, className) 
if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal


...in the hasClass.js module from the dom-helpers package included with the old react-addons-css-transition-group.



react-test-renderer...




...provides an experimental React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment




...so it doesn't implement everything provided by the DOM.



In this case it looks like react-test-renderer is not providing an implementation of classList on an element so calling element.className.baseVal throws the error you are seeing.






share|improve this answer

























  • First of all thanks for your feedback. Now I have updated my code to "react-transition-group" v4 the previous error is resolved, but now I am getting a new error "TypeError: element.setAttribute is not a function"

    – Hammad Tariq
    Apr 22 at 16:18











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%2f55380937%2ftypeerror-cannot-read-property-baseval-of-undefined%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









2














react-addons-css-transition-group is an old package that was deprecated in favor of react-transition-group.



v1 of react-transition-group was a drop-in replacement, but it was rewritten in v2.



You'll probably want to move to CSSTransition from the latest react-transition-group.




Having said that, the error is coming from this code:



function hasClass(element, className) 
if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal


...in the hasClass.js module from the dom-helpers package included with the old react-addons-css-transition-group.



react-test-renderer...




...provides an experimental React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment




...so it doesn't implement everything provided by the DOM.



In this case it looks like react-test-renderer is not providing an implementation of classList on an element so calling element.className.baseVal throws the error you are seeing.






share|improve this answer

























  • First of all thanks for your feedback. Now I have updated my code to "react-transition-group" v4 the previous error is resolved, but now I am getting a new error "TypeError: element.setAttribute is not a function"

    – Hammad Tariq
    Apr 22 at 16:18
















2














react-addons-css-transition-group is an old package that was deprecated in favor of react-transition-group.



v1 of react-transition-group was a drop-in replacement, but it was rewritten in v2.



You'll probably want to move to CSSTransition from the latest react-transition-group.




Having said that, the error is coming from this code:



function hasClass(element, className) 
if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal


...in the hasClass.js module from the dom-helpers package included with the old react-addons-css-transition-group.



react-test-renderer...




...provides an experimental React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment




...so it doesn't implement everything provided by the DOM.



In this case it looks like react-test-renderer is not providing an implementation of classList on an element so calling element.className.baseVal throws the error you are seeing.






share|improve this answer

























  • First of all thanks for your feedback. Now I have updated my code to "react-transition-group" v4 the previous error is resolved, but now I am getting a new error "TypeError: element.setAttribute is not a function"

    – Hammad Tariq
    Apr 22 at 16:18














2












2








2







react-addons-css-transition-group is an old package that was deprecated in favor of react-transition-group.



v1 of react-transition-group was a drop-in replacement, but it was rewritten in v2.



You'll probably want to move to CSSTransition from the latest react-transition-group.




Having said that, the error is coming from this code:



function hasClass(element, className) 
if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal


...in the hasClass.js module from the dom-helpers package included with the old react-addons-css-transition-group.



react-test-renderer...




...provides an experimental React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment




...so it doesn't implement everything provided by the DOM.



In this case it looks like react-test-renderer is not providing an implementation of classList on an element so calling element.className.baseVal throws the error you are seeing.






share|improve this answer













react-addons-css-transition-group is an old package that was deprecated in favor of react-transition-group.



v1 of react-transition-group was a drop-in replacement, but it was rewritten in v2.



You'll probably want to move to CSSTransition from the latest react-transition-group.




Having said that, the error is coming from this code:



function hasClass(element, className) 
if (element.classList) return !!className && element.classList.contains(className);else return (" " + (element.className.baseVal


...in the hasClass.js module from the dom-helpers package included with the old react-addons-css-transition-group.



react-test-renderer...




...provides an experimental React renderer that can be used to render React components to pure JavaScript objects, without depending on the DOM or a native mobile environment




...so it doesn't implement everything provided by the DOM.



In this case it looks like react-test-renderer is not providing an implementation of classList on an element so calling element.className.baseVal throws the error you are seeing.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 18:22









brian-lives-outdoorsbrian-lives-outdoors

15.3k1 gold badge17 silver badges43 bronze badges




15.3k1 gold badge17 silver badges43 bronze badges















  • First of all thanks for your feedback. Now I have updated my code to "react-transition-group" v4 the previous error is resolved, but now I am getting a new error "TypeError: element.setAttribute is not a function"

    – Hammad Tariq
    Apr 22 at 16:18


















  • First of all thanks for your feedback. Now I have updated my code to "react-transition-group" v4 the previous error is resolved, but now I am getting a new error "TypeError: element.setAttribute is not a function"

    – Hammad Tariq
    Apr 22 at 16:18

















First of all thanks for your feedback. Now I have updated my code to "react-transition-group" v4 the previous error is resolved, but now I am getting a new error "TypeError: element.setAttribute is not a function"

– Hammad Tariq
Apr 22 at 16:18






First of all thanks for your feedback. Now I have updated my code to "react-transition-group" v4 the previous error is resolved, but now I am getting a new error "TypeError: element.setAttribute is not a function"

– Hammad Tariq
Apr 22 at 16:18









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%2f55380937%2ftypeerror-cannot-read-property-baseval-of-undefined%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

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해