When trying to use fetch in React to GET, POST, etc., you can't use current_user in the controller because you don't have Session object available. Session returns:
#ActionDispatch::Request::Session:0x7ffc75e90a88 not yet loaded
You need to add credentials: 'include' to fetch params.
Read the explainer here: https://github.com/github/fetch#sending-cookies
More posts by this author