title: Accessing props in stateless child component (React js + Spring Security)
body: <p>So I am making a Spring Boot app with React front. On the main page there is a login form, rendered as constant. Within that constant I have a handleSubmit, which sends request to server and successfully gets a response data, as html (I can only console.log it).</p>
  
  <p>My question is: how do I pass this response from my form (const) to the main page, for rendering?</p>
  
  <p>Here is the login form:</p>
  
  <pre><code>import React, { Component } from "react";
  import { Formiz, useForm } from "@formiz/core";
  import { isEmail } from "@formiz/validations"; // Import some validations
  import { MyField } from "./myField";
  import axios from "axios";
  import { Link, Redirect } from "react-router-dom";
  
  export const MyForm2 = () =&gt; {
    const myForm = useForm();
    let resp = "null";
  
    const handleSubmit = (values, event) =&gt; {
      console.log(values.email + ", " + values.password);
  
      axios({
        method: "post",
        url: "/",
        data: {
          j_username: values.email,
          j_password: values.password
        }
      })
        .then(function(response) {
          if (response.status === 200) {
            console.log("login success");
            resp = response.data;
            console.log(resp);
          } else {
            console.log("login response: " + JSON.stringify(response));
          }
        })
        .catch(function(error) {
          console.log(error);
        });
    };
  
    //console.log("resp: "+JSON.stringify(resp));   //--ALWAYS "null"
  
    return (
      &lt;Formiz connect={myForm} onValidSubmit={handleSubmit}&gt;
        &lt;form noValidate onSubmit={myForm.submit}&gt;
          &lt;MyField
            name="email"
            label="E-mail: "
            validations={[
              {
                rule: isEmail(),
                message: "This is not a valid email"
              }
            ]}
          /&gt;
          &lt;MyField name="password" label="Password: " type="password" /&gt;
          &lt;button type="submit" disabled={!myForm.isValid}&gt;
            Submit
          &lt;/button&gt;
        &lt;/form&gt;
      &lt;/Formiz&gt;
    );
  };
  </code></pre>