|
@@ -1,11 +1,12 @@
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
import Form from './Form';
|
|
import Form from './Form';
|
|
|
import SharedTile from '../Utils/SharedTitle';
|
|
import SharedTile from '../Utils/SharedTitle';
|
|
|
|
|
+import Code from '../Utils/Code';
|
|
|
|
|
|
|
|
const FormDemo = () => {
|
|
const FormDemo = () => {
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
- <SharedTile/>
|
|
|
|
|
|
|
+ <SharedTile />
|
|
|
<p>
|
|
<p>
|
|
|
This form is constructed purely in React without any external library.
|
|
This form is constructed purely in React without any external library.
|
|
|
The placeholders and validation are implemented in pure Javascript, thus
|
|
The placeholders and validation are implemented in pure Javascript, thus
|
|
@@ -14,11 +15,11 @@ const FormDemo = () => {
|
|
|
logic on large forms is still challegning in react as the code could
|
|
logic on large forms is still challegning in react as the code could
|
|
|
become extremely verbose and repeative. A library is still required to
|
|
become extremely verbose and repeative. A library is still required to
|
|
|
handle more professional and long forms with complex validation process.
|
|
handle more professional and long forms with complex validation process.
|
|
|
- In addition, using <code>setState</code> multiple times in one function
|
|
|
|
|
- can lead to sublte bugs as this <code>setState</code> is asynchronous.
|
|
|
|
|
- Updating the state with <code>setState</code> then checking certain
|
|
|
|
|
|
|
+ In addition, using <Code>setState</Code> multiple times in one function
|
|
|
|
|
+ can lead to sublte bugs as this <Code>setState</Code> is asynchronous.
|
|
|
|
|
+ Updating the state with <Code>setState</Code> then checking certain
|
|
|
conditions based on the new state in one function does not work. Use a
|
|
conditions based on the new state in one function does not work. Use a
|
|
|
- callback function in <code>setState</code> instead.
|
|
|
|
|
|
|
+ callback function in <Code>setState</Code> instead.
|
|
|
</p>
|
|
</p>
|
|
|
<hr />
|
|
<hr />
|
|
|
<Form />
|
|
<Form />
|