Please fix those errors.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please fix those errors.

import React from 'react';
class ContactForm extends React.Component {
 constructor(props) {
  super(props);
  this.state = {
   name: '',
   storageType: '',
   maxItem: '',
   resourceName: '',
   maxResource: '',
   resourceType: '',
   currentResource: '',
   display: false
  };
  this.handleNameChange = this.handleNameChange.bind(this);
  this.handleStorageTypeChange = this.handleStorageTypeChange.bind(this);
  this.handleMaxItemChange = this.handleMaxItemChange.bind(this);
  this.handleResourceNameChange = this.handleResourceNameChange.bind(this);
  this.handleResourceTypeChange = this.handleResourceTypeChange.bind(this);
  this.handleMaxResourceChange = this.handleMaxResourceChange.bind(this);
  this.handleCurrentResourceChange = this.handleCurrentResourceChange.bind(this);
  this.handleSubmit = this.handleSubmit.bind(this);
 }
 handleNameChange(event) {
  const target = event.target;
  const value = target.type === 'checkbox' ? target.checked : target.value;
  const name = target.name;

  this.setState({
   name: value
  })
  console.log('Change detected. State updated' + name + ' = ' + value);

 }
 handleStorageTypeChange(event) {
  const target = event.target;
  const value = target.type === 'checkbox' ? target.checked : target.value;

  this.setState({
   storageType: value
  })
 }
 handleMaxItemChange(event) {
  const target = event.target;
  const value = target.type === 'checkbox' ? target.checked : target.value;

  this.setState({
   maxItem: value
  })
 }
 handleResourceNameChange(event) {
  this.setState({
   resourceName: event.target.value
  })
 }
 handleResourceTypeChange(event) {
  this.setState({
   resourceType: event.target.value
  })
 }
 handleMaxResourceChange(event) {
  this.setState({
   maxResource: event.target.value
  })
 }
 handleCurrentResourceChange(event) {
  this.setState({
   currentResource: event.target.value
  })
 }
 handleSubmit() {
  this.setState({
   display: true
  })
 }
 displayButtons() {
  const back = <div>
   <input type="button" onClick={this.handleSubmit} value="Back" />
  <input type="button" onClick={this.handleSubmit} value="Edit" />
  <input type="button" onClick={this.handleSubmit} value="Delete" /></div>
  return back;
 }
 render() {
  return (
   <div>
    <form>
     <div className="form-group">
      <h1> Inventory </h1>
      <label for="nameInput">Name</label>
      <input type="text" name="name" value={this.state.name} onChange={this.handleNameChange}
       className="form-control" id="nameInput" placeholder="Name" />
     </div>
     <div className="form-group">
      <label for="storageType">Storage Type</label>
      <input name="storage" type="text" value={this.state.storageType} onChange={this.handleStorageTypeChange}
       className="form-control" id="storageType" placeholder="Storage Type" />
     </div>
     <div className="form-group">
      <label for="nameInput">Max Item Capacity</label>
      <input type="text" name="maxItem" value={this.state.maxItem} onChange={this.handleMaxItemChange}
       className="form-control" id="nameInput" placeholder="Max Item Capacity" />
     </div>
     <div className="form-group">
      <h1> Resources </h1>
      <label for="nameInput">Resource Name</label>
      <input type="text" name="resourceName" value={this.state.resourceName} onChange={this.handleResourceNameChange}
       className="form-control" id="nameInput" placeholder="Resource Name" />
     </div>
     <div className="form-group">
      <label for="nameInput">Resource Type</label>
      <input name="resourceType" value={this.state.resourceType} onChange={this.handleResourceTypeChange}
       className="form-control" id="nameInput" placeholder="Resource Type" />
     </div>
     <div className="form-group">
      <label for="nameInput">Max Number of Resources</label>
      <input name="maxResource" value={this.state.maxResource} onChange={this.handleMaxResourceChange}
       className="form-control" id="nameInput" placeholder="Max Number of Resources" />
     </div>
     <div className="form-group">
      <label for="nameInput">Current Number of Resources</label>
      <input type="text" name="currentResource" value={this.state.currentResource} onChange={this.handleCurrentResourceChange}
       className="form-control" id="nameInput" placeholder="Current number of Resources" />
     </div>
     <input type="button" onClick={this.handleSubmit} value="Submit form" />
     {this.state.display ? this.displayButtons() : ''}
    </form>
   </div>
  )
 }

}
class MainTitle extends React.Component {
 render() {
  return (
   <h1> Add Inventory </h1>
  )
 }
}
export default class App extends React.Component {
 render() {
  return (
   <div>
    <MainTitle />
    <ContactForm />
   </div>
  )
 }

}

TS2339: Property 'storageType' does not exist on type 'Readonly<{}>'.
93
<div className="form-group">
94
<label for="storageType">Storage Type</label>
<input name="storage" type="text" value={this.state.storageType} onChange={this.handleStorageTypeChange}
className="form-control" id="storageType" placeholder="Storage Type" />
> 95 1
Add Inventory
Inventory
96
Nar
97 me
</div>
Stoggle Type Stor<div className="form-group">
Max Item Capacity Max Item Capacity
Resources
ERROR in src/Views/AddInventory.tsx:99:14
Resource Type Resou
TS2322: Type { children: string; for: string; }' is not assignable to type 'Detailed HTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'.
Property for does not exist on type 'DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'. Did you mean 'htmlFor'?
97
Subr
</div>
98 m
<div className="form-group">
<label for="nameInput">Max Item Capacity</label>
> 99 |
100
101
102
About
ERROR in src/Views/AddInventory.tsx: 100:59
. Search Client
101
102 |
103 |
AMA
</div>
TS2339: Property 'maxItem' does not exist on type 'Readonly<{}>'.
Aġġ Client <div className="form-group">
99
<input type="text" name="maxItem" value={this.state.maxItem} onChange={this.handleMaxItemChange}
className="form-control" id="nameInput" placeholder="Max Item Capacity" />
104 |
> 105 |
<label for="nameInput">Max Item Capacity</label>
• >100Inventory <input type="text" name="maxItem" value={this.state.maxItem} onChange={this.handleMaxItemChange}
className="form-control" id="nameInput" placeholder="Max Item Capacity" />
106
^^^^^^^^^^^
</div>
<div className="form-group">
ERROR in src/Views/AddInventory.tsx: 105:14
TS2322: Type { children: string; for: string; }' is not assignable to type 'DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'.
Property for' does not exist on type 'DetailedHTML Props<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'. Did you mean 'htmlFor'?
103
<div className="form-group">
<h1> Resources </h1>
<label for="nameInput">Resource Name</label>
<input type="text" name="resourceName" value={this.state.resourceName} onChange={this.handleResourceNameChange}
AMA
^^^^^^^
Transcribed Image Text:TS2339: Property 'storageType' does not exist on type 'Readonly<{}>'. 93 <div className="form-group"> 94 <label for="storageType">Storage Type</label> <input name="storage" type="text" value={this.state.storageType} onChange={this.handleStorageTypeChange} className="form-control" id="storageType" placeholder="Storage Type" /> > 95 1 Add Inventory Inventory 96 Nar 97 me </div> Stoggle Type Stor<div className="form-group"> Max Item Capacity Max Item Capacity Resources ERROR in src/Views/AddInventory.tsx:99:14 Resource Type Resou TS2322: Type { children: string; for: string; }' is not assignable to type 'Detailed HTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'. Property for does not exist on type 'DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'. Did you mean 'htmlFor'? 97 Subr </div> 98 m <div className="form-group"> <label for="nameInput">Max Item Capacity</label> > 99 | 100 101 102 About ERROR in src/Views/AddInventory.tsx: 100:59 . Search Client 101 102 | 103 | AMA </div> TS2339: Property 'maxItem' does not exist on type 'Readonly<{}>'. Aġġ Client <div className="form-group"> 99 <input type="text" name="maxItem" value={this.state.maxItem} onChange={this.handleMaxItemChange} className="form-control" id="nameInput" placeholder="Max Item Capacity" /> 104 | > 105 | <label for="nameInput">Max Item Capacity</label> • >100Inventory <input type="text" name="maxItem" value={this.state.maxItem} onChange={this.handleMaxItemChange} className="form-control" id="nameInput" placeholder="Max Item Capacity" /> 106 ^^^^^^^^^^^ </div> <div className="form-group"> ERROR in src/Views/AddInventory.tsx: 105:14 TS2322: Type { children: string; for: string; }' is not assignable to type 'DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'. Property for' does not exist on type 'DetailedHTML Props<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>'. Did you mean 'htmlFor'? 103 <div className="form-group"> <h1> Resources </h1> <label for="nameInput">Resource Name</label> <input type="text" name="resourceName" value={this.state.resourceName} onChange={this.handleResourceNameChange} AMA ^^^^^^^
TS7006: Parameter props 't
1 import React from 'react';
2
class Contact Form extends React.Component {
> 3 | constructor(props) {
Add Inventory
Inv4tory super (props);
this.state = {
Nare lame
Storage Typename:
Max Item Capacity Max Item Capacity
ERROR in src/Views/AddInventory.tsx:24:19
Resource Name Resource Name
TS7006: Parameter 'event' implicitly has an 'any' type.
Ma 22 umberthis.handleSubmit = this.handleSubmit.bind(this);
Cur23it Nur ber of Resources Current number of Resour
> 24tform handleNameChange (event) {
^^^^^
implicitly hasdan e'any type.
^^^^^
25
26
27 |
Home
ERROR in src/Views/AddInventory.tsx:35:26
33
34.
And client
> 35
TS7006: Parameter 'event' implicitly has an 'any' type.
Client
const target = event.target;
const value = target.type === 'checkbox' ? target.checked target.value;
const name = target.name;
Add Inventory
36 T
37
38 |
> 43
44
45 |
46
handleStorageTypeChange (event) {
^^^^^
41 |
42 | }
ERROR in src/Views/AddInventory.tsx:43:22
TS7006: Parameter 'event' implicitly has an 'any' type.
})
const target = event.target;
const value = target.type === 'checkbox' ? target.checked target.value;
handleMaxItemChange (event) {
^^^^^
const target= event.target;
const value = target.type === 'checkbox' ? target.checked target.value;
Transcribed Image Text:TS7006: Parameter props 't 1 import React from 'react'; 2 class Contact Form extends React.Component { > 3 | constructor(props) { Add Inventory Inv4tory super (props); this.state = { Nare lame Storage Typename: Max Item Capacity Max Item Capacity ERROR in src/Views/AddInventory.tsx:24:19 Resource Name Resource Name TS7006: Parameter 'event' implicitly has an 'any' type. Ma 22 umberthis.handleSubmit = this.handleSubmit.bind(this); Cur23it Nur ber of Resources Current number of Resour > 24tform handleNameChange (event) { ^^^^^ implicitly hasdan e'any type. ^^^^^ 25 26 27 | Home ERROR in src/Views/AddInventory.tsx:35:26 33 34. And client > 35 TS7006: Parameter 'event' implicitly has an 'any' type. Client const target = event.target; const value = target.type === 'checkbox' ? target.checked target.value; const name = target.name; Add Inventory 36 T 37 38 | > 43 44 45 | 46 handleStorageTypeChange (event) { ^^^^^ 41 | 42 | } ERROR in src/Views/AddInventory.tsx:43:22 TS7006: Parameter 'event' implicitly has an 'any' type. }) const target = event.target; const value = target.type === 'checkbox' ? target.checked target.value; handleMaxItemChange (event) { ^^^^^ const target= event.target; const value = target.type === 'checkbox' ? target.checked target.value;
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY