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;
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
add a comment |
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
2
can you either paste the full stack trace, or paste the piece of code where you readmyObj.baseVal?
– Christopher Francisco
Mar 27 at 15:30
add a comment |
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
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
reactjs unit-testing jestjs reactcsstransitiongroup react-test-renderer
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 readmyObj.baseVal?
– Christopher Francisco
Mar 27 at 15:30
add a comment |
2
can you either paste the full stack trace, or paste the piece of code where you readmyObj.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
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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