// app.js
import React, {useState, useEffect} from 'react'
import {Link, Redirect, useHistory} from '@ttk/router'
import {Button, Card} from 'antd'

export default React.memo(Page)
function Page(props) {
  const [isRedirace, setIsRedirect] = useState(false)

  const history =  useHistory()

  const {root, state, params} = props.location

  const skipBack = () => {
    history.push(`${root}/layout/route-params`)
  }

  useEffect(() => {
    // console.log(123, props)
  }, [props])

  return (
    <Card
      className="ttk-card-form"
    >
      <div >
        状态state: 
        <pre>{JSON.stringify(state, null, "  ")}</pre>
        <br />
        查询参数search: 
        <pre>{JSON.stringify(params,  null, "  ")}</pre>
        <br />
        <br />
        <Button onClick={skipBack}>返回</Button>
      </div>
    </Card>
  )
}