This snippet allows you to expose custom fields in the REST API, enabling front-end frameworks to access ACF data.
add_action('rest_api_init', function() {
register_rest_field('post', 'custom_fields', array(
'get_callback' => function($post_arr) {
return get_fields($post_arr['id']);
},
'schema' => null,
));
});