Answer the question
In order to leave comments, you need to log in
How to make a js request from react?
There is a button Show more when you click on which, without reloading, I want to load new objects
const UsersPageButton = ({ bottomUrl }) => {
const userClick = e => {
e.preventDefault();
const page = bottomUrl.slice(-1);
const axios = require('axios');
const url = '/users'
const data = { 'page': page };
const options = {
method: 'get',
headers: { "Content-Type": "application/json" },
data: data,
url,
}
axios(options);
};
return (
<a className="button" onClick={userClick} href={bottomUrl}>Показать еще</a>
)
};
$(".users-list").html("<%= j render 'users/users', users: @users %>")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question