title: Export const in react
body: <p>Hello guys how can I export my <code>const history</code> to use the same history in another component.
  I try to use this history for use <code>history.push</code> in antoher views and components .</p>
  
  <pre><code>export function login(data) {
  
  const history = createBrowserHistory({
  forceRefresh: true
  })
  
  const endpoint = '/api/auth/jwt/'
  const csrfToken = cookie.load('csrftoken')
  let thisComp = this
  if (csrfToken !== undefined) {
    let lookupOptions = {
        method: "POST",
        headers: {
            'Content-Type': 'application/json'
  
        },
        body: JSON.stringify(data),
        credentials: 'include'
    }
  
    fetch(endpoint, lookupOptions)
    .then(function(response){
        return response.json()
    }).then(function(responseData){
        console.log(responseData)
        localStorage.token = responseData.token
        localStorage.expires = responseData.expires // Store the token
        console.log("Token Stored", localStorage.token)
        console.log("Token Expires", responseData.expires)
        refreshToken(localStorage.token)
        history.push('/meals/')
  
  
      }).catch(function(error){
  
        console.log("error", error)
    })
  }
  
  }
  </code></pre>
  
  <p>Thanks you for your help.</p>