How can I use this solution in React?
chwonseok opened this issue · 1 comments
Hey there, first of all, thanks for this nice solution what I've been looking for!
I'm currently stuck with one minor issue though.
The issue is that it doesn't print thankyou_message
after the mail has been successfully sent, which means I see {"result": "success", ...}
only.
In public folder, I attached form-submission-handler.js
, and the place where I added <script>
tag is in the index.html in public folder, like below.
<body>
<div id="root"></div>
<script data-cfasync="false" src="%PUBLIC_URL%/form-submission-handler.js"></script>
</body>
If it is not the way or place to use this solution in JSX, could you please let me know?
Thanks in advance!
Not sure what exactly you are actually asking, and what this has to do with React, but I'll try to answer anyways.
Here, thankyou_message
is not something to be printed, it is just a CSS id
to be given to a div
.
<div style="display:none;" id="thankyou_message">
Your message here
</div>
When styled properly, form-submission-handler.js
will find the div
above by its id
and show it with the line below.
document.getElementById("thankyou_message").style.display = "block";