Get help on our basic JavaScript and Algorithms Challenges. If you are posting code that is large use Gist - https://gist.github.com/ paste the link here.
i cant understand why i cant use
res.write(html)
res.end()
thats what the instructor is doing and everyone on stack overflow, but for me res.end() gets called before write
is write recently async or sometihng?
So, I reuse code similar to this
<div className="field">
<label className="label">Supervisor's Name</label>
<div className="control">
<InputField
type={"text"}
placeHolder={"Supervisor's Name"}
value={props.jsaForm.name}
onChange={props.inputName}
required={true}
/>
</div>
</div>
So I want to change that to its own component.
const Field = (props) => (
<div className="field">
<label className="label">{props.label}</label>
<div className="control">
{props.formElement}
</div>
</div>
)
But...I feel like I should be doing something with children instead here...?
props.children
in the div and then pass the sub components as children to Field instead of declaring it explicitly within Field
label
and then some sort of formElement (input, select, etc)
({children}) =>...
or (props, {children}) =>...
(not sure if that is even valid lol)
({children, ...props}) => ...
maybe?
So ultimately.. I'm looking to have
<Field label="My Label">
<InputField
type={"text"}
placeHolder={"Supervisor's Name"}
value={props.jsaForm.name}
onChange={props.inputName}
required={true}
/>
<Field />
Or would the label part not be correct?
for
unless it is wrapping the element?
for
?
<label for="id-of-element">Label Text</label>
for
in a label