Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
351 views
in Technique[技术] by (71.8m points)

reactjs - Fetch laravel8 fortify, sanctum api data and show in react with props

I have laravel backend application running on port 8000. It uses fortify and sanctum package for api and all routes are available for SPA. I have a demo application in next.js which is connecting and working fine with backend part. I am following these examples from github for laravel and next.js https://github.com/ggelashvili/laravel-fortify-spa-backend

But next.js is not what I want to use in the end but REACT. So how could I make this work with react? How can i access the csrf token, login controller of fortify and api data?

I tried to copy all files from https://github.com/ggelashvili/laravel-fortify-spa-frontend to my react app but it shows this error.

TypeError: Cannot set property 'props' of undefined

Once I fetch the data, how can I pass it in a different component with props?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...