How to change the state of one class from a function in a different classHow to change the href for a hyperlink using jQueryHow to change an element's class with JavaScript?How do I remove a property from a JavaScript object?How do I add a class to a given element?How can I select an element with multiple classes in jQuery?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?What is the difference between state and props in React?What's the difference between “super()” and “super(props)” in React when using es6 classes?Invariant Violation: Objects are not valid as a React child
How to detect nM levels of Copper(I) Oxide in blood?
Changing stroke width vertically but not horizontally in Inkscape
How to say something covers all the view up to the horizon line?
When did England stop being a Papal fief?
Why is the blank symbol not considered part of the input alphabet of a Turing machine?
Is there a word for food that's gone 'bad', but is still edible?
What does のそ mean on this picture?
Subnumcases as a part of align
Efficient deletion of specific list entries
How to speed up large double sums in a table?
The selling of the sheep
Who filmed the Apollo 11 trans-lunar injection?
Python 3 - simple temperature program version 1.3
How long does it take a postcard to get from USA to Germany?
Can you figure out this language?
Can I enter the USA?
How to deal with employer who keeps me at work after working hours
All of my Firefox add-ons been disabled suddenly, how can I re-enable them?
Is it normal for gliders not to have attitude indicators?
Make me a minimum magic sum
Can anyone identify this unknown 1988 PC card from The Palantir Corporation?
Given a safe domain, are subdirectories safe as well?
GitLab account hacked and repo wiped
What are the requirements for a river delta to form?
How to change the state of one class from a function in a different class
How to change the href for a hyperlink using jQueryHow to change an element's class with JavaScript?How do I remove a property from a JavaScript object?How do I add a class to a given element?How can I select an element with multiple classes in jQuery?How do I remove a particular element from an array in JavaScript?How do I return the response from an asynchronous call?What is the difference between state and props in React?What's the difference between “super()” and “super(props)” in React when using es6 classes?Invariant Violation: Objects are not valid as a React child
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a "edit" button that is created within a draggable-target class, which is basically an editable div box. When this button is clicked, it should change the state of the drawer class, making it "open", by calling the function handleDrawerOpen() in the drawer class. Any solutions as to how to effectively change the state of the drawer?
I've tried the method of making the drawer a constant object and calling the function of the object, but that isn't working for some reason.
This is the state and function for handleDrawerOpen/Close in the temporary drawer class, as well as how I'm exporting it to be used in other classes.
state =
open: false,
;
handleDrawerOpen = () =>
this.setState( open: true );
;
handleDrawerClose = () =>
this.setState( open: false );
;
[rest of code here]
TemporaryDrawer.propTypes =
classes: PropTypes.object.isRequired,
;
const drawer = new TemporaryDrawer();
export default withStyles(styles)(TemporaryDrawer);
This is the edit button code in a different class. TemporaryDrawer is being imported into this class as well.
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen;
I'm not getting any errors, but the drawer isn't opening when I click the edit button.
This is how I'm importing the temporarydrawer into the class where the button is called. I'm importing both the drawer object and the actual TemporaryDrawer class because the class itself needs to be displayed within the career-app class.
import drawer from './TemporaryDrawer.js';
import TemporaryDrawer from './TemporaryDrawer.js';
And this is how it's being rendered within the render function.
<div className="careerApp">
<TemporaryDrawer handleDrop=(target, type, name) => this.handleDrop(target, type, name)/>
[There's a bunch of code here]
</div>
javascript reactjs ecmascript-6
|
show 3 more comments
I have a "edit" button that is created within a draggable-target class, which is basically an editable div box. When this button is clicked, it should change the state of the drawer class, making it "open", by calling the function handleDrawerOpen() in the drawer class. Any solutions as to how to effectively change the state of the drawer?
I've tried the method of making the drawer a constant object and calling the function of the object, but that isn't working for some reason.
This is the state and function for handleDrawerOpen/Close in the temporary drawer class, as well as how I'm exporting it to be used in other classes.
state =
open: false,
;
handleDrawerOpen = () =>
this.setState( open: true );
;
handleDrawerClose = () =>
this.setState( open: false );
;
[rest of code here]
TemporaryDrawer.propTypes =
classes: PropTypes.object.isRequired,
;
const drawer = new TemporaryDrawer();
export default withStyles(styles)(TemporaryDrawer);
This is the edit button code in a different class. TemporaryDrawer is being imported into this class as well.
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen;
I'm not getting any errors, but the drawer isn't opening when I click the edit button.
This is how I'm importing the temporarydrawer into the class where the button is called. I'm importing both the drawer object and the actual TemporaryDrawer class because the class itself needs to be displayed within the career-app class.
import drawer from './TemporaryDrawer.js';
import TemporaryDrawer from './TemporaryDrawer.js';
And this is how it's being rendered within the render function.
<div className="careerApp">
<TemporaryDrawer handleDrop=(target, type, name) => this.handleDrop(target, type, name)/>
[There's a bunch of code here]
</div>
javascript reactjs ecmascript-6
isn't it in react? also add react tag.
– Bhojendra Rauniyar
Mar 23 at 4:33
have you tried removing the class then adding it back? that's what I do
– Andrew Hansen
Mar 23 at 4:34
@BhojendraRauniyar yes, sorry about that. I've added the tag.
– Sira Nassoko
Mar 23 at 4:38
@AndrewHansen like the whole entire drawer class?
– Sira Nassoko
Mar 23 at 4:38
1
this looks like an import/export module issue. can you please add the code how you are importingTemporaryDrawerand how it is being used inrenderfunction ?
– Pranay Tripathi
Mar 23 at 5:01
|
show 3 more comments
I have a "edit" button that is created within a draggable-target class, which is basically an editable div box. When this button is clicked, it should change the state of the drawer class, making it "open", by calling the function handleDrawerOpen() in the drawer class. Any solutions as to how to effectively change the state of the drawer?
I've tried the method of making the drawer a constant object and calling the function of the object, but that isn't working for some reason.
This is the state and function for handleDrawerOpen/Close in the temporary drawer class, as well as how I'm exporting it to be used in other classes.
state =
open: false,
;
handleDrawerOpen = () =>
this.setState( open: true );
;
handleDrawerClose = () =>
this.setState( open: false );
;
[rest of code here]
TemporaryDrawer.propTypes =
classes: PropTypes.object.isRequired,
;
const drawer = new TemporaryDrawer();
export default withStyles(styles)(TemporaryDrawer);
This is the edit button code in a different class. TemporaryDrawer is being imported into this class as well.
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen;
I'm not getting any errors, but the drawer isn't opening when I click the edit button.
This is how I'm importing the temporarydrawer into the class where the button is called. I'm importing both the drawer object and the actual TemporaryDrawer class because the class itself needs to be displayed within the career-app class.
import drawer from './TemporaryDrawer.js';
import TemporaryDrawer from './TemporaryDrawer.js';
And this is how it's being rendered within the render function.
<div className="careerApp">
<TemporaryDrawer handleDrop=(target, type, name) => this.handleDrop(target, type, name)/>
[There's a bunch of code here]
</div>
javascript reactjs ecmascript-6
I have a "edit" button that is created within a draggable-target class, which is basically an editable div box. When this button is clicked, it should change the state of the drawer class, making it "open", by calling the function handleDrawerOpen() in the drawer class. Any solutions as to how to effectively change the state of the drawer?
I've tried the method of making the drawer a constant object and calling the function of the object, but that isn't working for some reason.
This is the state and function for handleDrawerOpen/Close in the temporary drawer class, as well as how I'm exporting it to be used in other classes.
state =
open: false,
;
handleDrawerOpen = () =>
this.setState( open: true );
;
handleDrawerClose = () =>
this.setState( open: false );
;
[rest of code here]
TemporaryDrawer.propTypes =
classes: PropTypes.object.isRequired,
;
const drawer = new TemporaryDrawer();
export default withStyles(styles)(TemporaryDrawer);
This is the edit button code in a different class. TemporaryDrawer is being imported into this class as well.
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen;
I'm not getting any errors, but the drawer isn't opening when I click the edit button.
This is how I'm importing the temporarydrawer into the class where the button is called. I'm importing both the drawer object and the actual TemporaryDrawer class because the class itself needs to be displayed within the career-app class.
import drawer from './TemporaryDrawer.js';
import TemporaryDrawer from './TemporaryDrawer.js';
And this is how it's being rendered within the render function.
<div className="careerApp">
<TemporaryDrawer handleDrop=(target, type, name) => this.handleDrop(target, type, name)/>
[There's a bunch of code here]
</div>
javascript reactjs ecmascript-6
javascript reactjs ecmascript-6
edited Mar 23 at 5:08
Sira Nassoko
asked Mar 23 at 4:32
Sira NassokoSira Nassoko
62
62
isn't it in react? also add react tag.
– Bhojendra Rauniyar
Mar 23 at 4:33
have you tried removing the class then adding it back? that's what I do
– Andrew Hansen
Mar 23 at 4:34
@BhojendraRauniyar yes, sorry about that. I've added the tag.
– Sira Nassoko
Mar 23 at 4:38
@AndrewHansen like the whole entire drawer class?
– Sira Nassoko
Mar 23 at 4:38
1
this looks like an import/export module issue. can you please add the code how you are importingTemporaryDrawerand how it is being used inrenderfunction ?
– Pranay Tripathi
Mar 23 at 5:01
|
show 3 more comments
isn't it in react? also add react tag.
– Bhojendra Rauniyar
Mar 23 at 4:33
have you tried removing the class then adding it back? that's what I do
– Andrew Hansen
Mar 23 at 4:34
@BhojendraRauniyar yes, sorry about that. I've added the tag.
– Sira Nassoko
Mar 23 at 4:38
@AndrewHansen like the whole entire drawer class?
– Sira Nassoko
Mar 23 at 4:38
1
this looks like an import/export module issue. can you please add the code how you are importingTemporaryDrawerand how it is being used inrenderfunction ?
– Pranay Tripathi
Mar 23 at 5:01
isn't it in react? also add react tag.
– Bhojendra Rauniyar
Mar 23 at 4:33
isn't it in react? also add react tag.
– Bhojendra Rauniyar
Mar 23 at 4:33
have you tried removing the class then adding it back? that's what I do
– Andrew Hansen
Mar 23 at 4:34
have you tried removing the class then adding it back? that's what I do
– Andrew Hansen
Mar 23 at 4:34
@BhojendraRauniyar yes, sorry about that. I've added the tag.
– Sira Nassoko
Mar 23 at 4:38
@BhojendraRauniyar yes, sorry about that. I've added the tag.
– Sira Nassoko
Mar 23 at 4:38
@AndrewHansen like the whole entire drawer class?
– Sira Nassoko
Mar 23 at 4:38
@AndrewHansen like the whole entire drawer class?
– Sira Nassoko
Mar 23 at 4:38
1
1
this looks like an import/export module issue. can you please add the code how you are importing
TemporaryDrawer and how it is being used in render function ?– Pranay Tripathi
Mar 23 at 5:01
this looks like an import/export module issue. can you please add the code how you are importing
TemporaryDrawer and how it is being used in render function ?– Pranay Tripathi
Mar 23 at 5:01
|
show 3 more comments
3 Answers
3
active
oldest
votes
You need to call drawer.handleDrawerOpen():
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
I've tried that, and kept getting an error that said "WEBPACK_IMPORTED_MODULE_10__TemporaryDrawer_js.a.handleDrawerOpen is not a function" –
– Sira Nassoko
Mar 23 at 4:50
add a comment |
As you can see in the import are used twice and each import points to a specific instance. The problem is when you are calling drawer.handleDrawerOpen(), the component is not being used any where so that why you are getting WEBPACK_IMPORTED_MODULE error. You cannot access the child function directly on the parent component. You will have to pass it as props handler to the editButton. Also have a look at the how you are structuring your components. This is not meant to be such complicated task. You can have a look at structuring you components in presentational and container structure. Have a look at the link.
If you can add the full components in codesandbox, we should be able to help you more.
Thanks for the advice. This is a prototype for a potential web app, so it's not really organized in the most conducive way, but I'll look into the presentational and container structure for the next iteration. I'm still a little confused about how to actually pass a props handler to the edit Button. Do you have an example? Also, I'll supply a link to my codepen, though I'm not sure how helpful it will be since you won't be able to actually see the components on the web page.
– Sira Nassoko
Mar 24 at 1:23
can you please share your codepen. I should be able to modify the code and give you a direction how can achieve the resolution to the problem.
– Pranay Tripathi
Mar 24 at 17:13
its here: codepen.io/siran2020/pen/bZzZaL again i dont know how useful this is going to be because there are a lot of moving parts and you cant really run it on codepen but hopefully seeing the code helps.
– Sira Nassoko
Mar 24 at 19:12
codepen.io/pranaytripathi/pen/PLLJzr?editors=0010. I have isolated the state and manipulating it based on different behaviour out of the component. Normally you dont want to do that as it can be a bit difficult to manipulate. You are better off maintaining a component as a stateless component and let the stateful component decide the the behaviour.
– Pranay Tripathi
Mar 25 at 11:28
add a comment |
Try with
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
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%2f55310626%2fhow-to-change-the-state-of-one-class-from-a-function-in-a-different-class%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to call drawer.handleDrawerOpen():
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
I've tried that, and kept getting an error that said "WEBPACK_IMPORTED_MODULE_10__TemporaryDrawer_js.a.handleDrawerOpen is not a function" –
– Sira Nassoko
Mar 23 at 4:50
add a comment |
You need to call drawer.handleDrawerOpen():
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
I've tried that, and kept getting an error that said "WEBPACK_IMPORTED_MODULE_10__TemporaryDrawer_js.a.handleDrawerOpen is not a function" –
– Sira Nassoko
Mar 23 at 4:50
add a comment |
You need to call drawer.handleDrawerOpen():
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
You need to call drawer.handleDrawerOpen():
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
answered Mar 23 at 4:37
Jack BashfordJack Bashford
19.8k52050
19.8k52050
I've tried that, and kept getting an error that said "WEBPACK_IMPORTED_MODULE_10__TemporaryDrawer_js.a.handleDrawerOpen is not a function" –
– Sira Nassoko
Mar 23 at 4:50
add a comment |
I've tried that, and kept getting an error that said "WEBPACK_IMPORTED_MODULE_10__TemporaryDrawer_js.a.handleDrawerOpen is not a function" –
– Sira Nassoko
Mar 23 at 4:50
I've tried that, and kept getting an error that said "WEBPACK_IMPORTED_MODULE_10__TemporaryDrawer_js.a.handleDrawerOpen is not a function" –
– Sira Nassoko
Mar 23 at 4:50
I've tried that, and kept getting an error that said "WEBPACK_IMPORTED_MODULE_10__TemporaryDrawer_js.a.handleDrawerOpen is not a function" –
– Sira Nassoko
Mar 23 at 4:50
add a comment |
As you can see in the import are used twice and each import points to a specific instance. The problem is when you are calling drawer.handleDrawerOpen(), the component is not being used any where so that why you are getting WEBPACK_IMPORTED_MODULE error. You cannot access the child function directly on the parent component. You will have to pass it as props handler to the editButton. Also have a look at the how you are structuring your components. This is not meant to be such complicated task. You can have a look at structuring you components in presentational and container structure. Have a look at the link.
If you can add the full components in codesandbox, we should be able to help you more.
Thanks for the advice. This is a prototype for a potential web app, so it's not really organized in the most conducive way, but I'll look into the presentational and container structure for the next iteration. I'm still a little confused about how to actually pass a props handler to the edit Button. Do you have an example? Also, I'll supply a link to my codepen, though I'm not sure how helpful it will be since you won't be able to actually see the components on the web page.
– Sira Nassoko
Mar 24 at 1:23
can you please share your codepen. I should be able to modify the code and give you a direction how can achieve the resolution to the problem.
– Pranay Tripathi
Mar 24 at 17:13
its here: codepen.io/siran2020/pen/bZzZaL again i dont know how useful this is going to be because there are a lot of moving parts and you cant really run it on codepen but hopefully seeing the code helps.
– Sira Nassoko
Mar 24 at 19:12
codepen.io/pranaytripathi/pen/PLLJzr?editors=0010. I have isolated the state and manipulating it based on different behaviour out of the component. Normally you dont want to do that as it can be a bit difficult to manipulate. You are better off maintaining a component as a stateless component and let the stateful component decide the the behaviour.
– Pranay Tripathi
Mar 25 at 11:28
add a comment |
As you can see in the import are used twice and each import points to a specific instance. The problem is when you are calling drawer.handleDrawerOpen(), the component is not being used any where so that why you are getting WEBPACK_IMPORTED_MODULE error. You cannot access the child function directly on the parent component. You will have to pass it as props handler to the editButton. Also have a look at the how you are structuring your components. This is not meant to be such complicated task. You can have a look at structuring you components in presentational and container structure. Have a look at the link.
If you can add the full components in codesandbox, we should be able to help you more.
Thanks for the advice. This is a prototype for a potential web app, so it's not really organized in the most conducive way, but I'll look into the presentational and container structure for the next iteration. I'm still a little confused about how to actually pass a props handler to the edit Button. Do you have an example? Also, I'll supply a link to my codepen, though I'm not sure how helpful it will be since you won't be able to actually see the components on the web page.
– Sira Nassoko
Mar 24 at 1:23
can you please share your codepen. I should be able to modify the code and give you a direction how can achieve the resolution to the problem.
– Pranay Tripathi
Mar 24 at 17:13
its here: codepen.io/siran2020/pen/bZzZaL again i dont know how useful this is going to be because there are a lot of moving parts and you cant really run it on codepen but hopefully seeing the code helps.
– Sira Nassoko
Mar 24 at 19:12
codepen.io/pranaytripathi/pen/PLLJzr?editors=0010. I have isolated the state and manipulating it based on different behaviour out of the component. Normally you dont want to do that as it can be a bit difficult to manipulate. You are better off maintaining a component as a stateless component and let the stateful component decide the the behaviour.
– Pranay Tripathi
Mar 25 at 11:28
add a comment |
As you can see in the import are used twice and each import points to a specific instance. The problem is when you are calling drawer.handleDrawerOpen(), the component is not being used any where so that why you are getting WEBPACK_IMPORTED_MODULE error. You cannot access the child function directly on the parent component. You will have to pass it as props handler to the editButton. Also have a look at the how you are structuring your components. This is not meant to be such complicated task. You can have a look at structuring you components in presentational and container structure. Have a look at the link.
If you can add the full components in codesandbox, we should be able to help you more.
As you can see in the import are used twice and each import points to a specific instance. The problem is when you are calling drawer.handleDrawerOpen(), the component is not being used any where so that why you are getting WEBPACK_IMPORTED_MODULE error. You cannot access the child function directly on the parent component. You will have to pass it as props handler to the editButton. Also have a look at the how you are structuring your components. This is not meant to be such complicated task. You can have a look at structuring you components in presentational and container structure. Have a look at the link.
If you can add the full components in codesandbox, we should be able to help you more.
answered Mar 23 at 5:52
Pranay TripathiPranay Tripathi
556513
556513
Thanks for the advice. This is a prototype for a potential web app, so it's not really organized in the most conducive way, but I'll look into the presentational and container structure for the next iteration. I'm still a little confused about how to actually pass a props handler to the edit Button. Do you have an example? Also, I'll supply a link to my codepen, though I'm not sure how helpful it will be since you won't be able to actually see the components on the web page.
– Sira Nassoko
Mar 24 at 1:23
can you please share your codepen. I should be able to modify the code and give you a direction how can achieve the resolution to the problem.
– Pranay Tripathi
Mar 24 at 17:13
its here: codepen.io/siran2020/pen/bZzZaL again i dont know how useful this is going to be because there are a lot of moving parts and you cant really run it on codepen but hopefully seeing the code helps.
– Sira Nassoko
Mar 24 at 19:12
codepen.io/pranaytripathi/pen/PLLJzr?editors=0010. I have isolated the state and manipulating it based on different behaviour out of the component. Normally you dont want to do that as it can be a bit difficult to manipulate. You are better off maintaining a component as a stateless component and let the stateful component decide the the behaviour.
– Pranay Tripathi
Mar 25 at 11:28
add a comment |
Thanks for the advice. This is a prototype for a potential web app, so it's not really organized in the most conducive way, but I'll look into the presentational and container structure for the next iteration. I'm still a little confused about how to actually pass a props handler to the edit Button. Do you have an example? Also, I'll supply a link to my codepen, though I'm not sure how helpful it will be since you won't be able to actually see the components on the web page.
– Sira Nassoko
Mar 24 at 1:23
can you please share your codepen. I should be able to modify the code and give you a direction how can achieve the resolution to the problem.
– Pranay Tripathi
Mar 24 at 17:13
its here: codepen.io/siran2020/pen/bZzZaL again i dont know how useful this is going to be because there are a lot of moving parts and you cant really run it on codepen but hopefully seeing the code helps.
– Sira Nassoko
Mar 24 at 19:12
codepen.io/pranaytripathi/pen/PLLJzr?editors=0010. I have isolated the state and manipulating it based on different behaviour out of the component. Normally you dont want to do that as it can be a bit difficult to manipulate. You are better off maintaining a component as a stateless component and let the stateful component decide the the behaviour.
– Pranay Tripathi
Mar 25 at 11:28
Thanks for the advice. This is a prototype for a potential web app, so it's not really organized in the most conducive way, but I'll look into the presentational and container structure for the next iteration. I'm still a little confused about how to actually pass a props handler to the edit Button. Do you have an example? Also, I'll supply a link to my codepen, though I'm not sure how helpful it will be since you won't be able to actually see the components on the web page.
– Sira Nassoko
Mar 24 at 1:23
Thanks for the advice. This is a prototype for a potential web app, so it's not really organized in the most conducive way, but I'll look into the presentational and container structure for the next iteration. I'm still a little confused about how to actually pass a props handler to the edit Button. Do you have an example? Also, I'll supply a link to my codepen, though I'm not sure how helpful it will be since you won't be able to actually see the components on the web page.
– Sira Nassoko
Mar 24 at 1:23
can you please share your codepen. I should be able to modify the code and give you a direction how can achieve the resolution to the problem.
– Pranay Tripathi
Mar 24 at 17:13
can you please share your codepen. I should be able to modify the code and give you a direction how can achieve the resolution to the problem.
– Pranay Tripathi
Mar 24 at 17:13
its here: codepen.io/siran2020/pen/bZzZaL again i dont know how useful this is going to be because there are a lot of moving parts and you cant really run it on codepen but hopefully seeing the code helps.
– Sira Nassoko
Mar 24 at 19:12
its here: codepen.io/siran2020/pen/bZzZaL again i dont know how useful this is going to be because there are a lot of moving parts and you cant really run it on codepen but hopefully seeing the code helps.
– Sira Nassoko
Mar 24 at 19:12
codepen.io/pranaytripathi/pen/PLLJzr?editors=0010. I have isolated the state and manipulating it based on different behaviour out of the component. Normally you dont want to do that as it can be a bit difficult to manipulate. You are better off maintaining a component as a stateless component and let the stateful component decide the the behaviour.
– Pranay Tripathi
Mar 25 at 11:28
codepen.io/pranaytripathi/pen/PLLJzr?editors=0010. I have isolated the state and manipulating it based on different behaviour out of the component. Normally you dont want to do that as it can be a bit difficult to manipulate. You are better off maintaining a component as a stateless component and let the stateful component decide the the behaviour.
– Pranay Tripathi
Mar 25 at 11:28
add a comment |
Try with
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
add a comment |
Try with
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
add a comment |
Try with
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
Try with
editButton()
console.log("working edit");
alert('You can drag a different field or occupation from the drawer at the left!');
drawer.handleDrawerOpen();
edited Mar 23 at 5:11
Pranay Tripathi
556513
556513
answered Mar 23 at 4:36
umer sayyedumer sayyed
562
562
add a comment |
add a comment |
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%2f55310626%2fhow-to-change-the-state-of-one-class-from-a-function-in-a-different-class%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
isn't it in react? also add react tag.
– Bhojendra Rauniyar
Mar 23 at 4:33
have you tried removing the class then adding it back? that's what I do
– Andrew Hansen
Mar 23 at 4:34
@BhojendraRauniyar yes, sorry about that. I've added the tag.
– Sira Nassoko
Mar 23 at 4:38
@AndrewHansen like the whole entire drawer class?
– Sira Nassoko
Mar 23 at 4:38
1
this looks like an import/export module issue. can you please add the code how you are importing
TemporaryDrawerand how it is being used inrenderfunction ?– Pranay Tripathi
Mar 23 at 5:01