I have no syntax error and the code compiles fine, but the called functional component, 'SuccessfulModal', never gets rendered.
my functional component
import React from 'react'
export default function SuccessfulModal() {
const hello = () => {
return alert("Welcome :)")
}
return (
<div>
{hello()}
</div>
)
}
my class component
import SuccessfulModal from "../successfulModal/SuccessfulModal"
export default class ConfirmationModal extends Component {
state = {
open: false,
revisionId: ""
}
saveOnClick = () => {
axios.put('http://localhost:8080/lagbevakning/revision/revisionsubscription', {
revisionId: 36,
})
.then((response) => {
console.log(response) /* Gets called */
this.setState({open: false}) /* Gets called */
return <SuccessfulModal/> /* Never gets called */
})
submitorCancelButton = () => (
<Button className="saveButton" onClick={this.saveOnClick}> Save </Button>
)
Render method
render() {
return (
<div>
{this.submitorCancelButton()}
</div>
)
}
rendermethod in your class, nothing will ever get, well, rendered..ConfirmationModal(if it exists) - it's impossible to know why it's rendering wrong if you don't show us what you're rendering!