簡體   English   中英

如何使用reactstrap庫在React中設置發布表單?

[英]How to setup a posting form in React with the reactstrap library?

我是React和reactstrap的新手,我想知道如何設置一個表單,該表單在使用Form-tag提交時發布到發布后的路由。 我在執行此操作的文檔中找不到示例。 因此,我正在尋找與之等效的東西:

<form action='/signup/insert' method = 'POST'>
    <div class="form-group">
        <input id ='signup' type='text' name='uid' placeholder='Username'><br>
        <input id ='signup' type='password' name='pwd' placeholder='Password'><br>
        <input id ='signup' type='text' name='email' placeholder='E-mail address'><br>
        <button id = 'switch' type='submit'>Sign Up</button>
     </div>
 </form>

我想要這樣的東西:

<Form>
    <FormGroup>
        <Label for="exampleEmail">Email</Label>
        <Input
            type="email"
            name="email"
            id="exampleEmail"
            placeholder="noreply@noreply.com"
        />
    </FormGroup>
    <FormGroup>
        <Label for="examplePassword">Password</Label>
        <Input
            type="password"
            name="password"
            id="examplePassword"
            placeholder="password"
        />
     </FormGroup>
     <Button>Sign Up</Button>
</Form>

我是否必須在button標簽中添加它? 這個怎么做? 我的路線已經設置好了,所以我只需要從這里發布。

與沒有Reactstrap的示例完全相同。 Form組件將您提供的所有屬性傳遞給在頁面上呈現的<form>標記,因此此代碼<Form action='/signup/insert' method='POST'>將起作用(如果您的后端設置為處理請求。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM