Home / File/ actions.js — react Source File

actions.js — react Source File

Architecture documentation for actions.js, a javascript file in the react codebase. 2 imports, 1 dependents.

File javascript BabelCompiler Entrypoint 2 imports 1 dependents 4 functions

Entity Profile

Dependency Diagram

graph LR
  41135158_bb00_046d_9f07_fa840a610429["actions.js"]
  3173919c_0109_ffd0_d2bb_df6479bfd61c["ServerState.js"]
  41135158_bb00_046d_9f07_fa840a610429 --> 3173919c_0109_ffd0_d2bb_df6479bfd61c
  11ebd183_e520_1c29_547a_68372f377ed0["setServerState"]
  41135158_bb00_046d_9f07_fa840a610429 --> 11ebd183_e520_1c29_547a_68372f377ed0
  b27c3f66_c90d_ed18_3ae4_582f9ff3b4e6["App.js"]
  b27c3f66_c90d_ed18_3ae4_582f9ff3b4e6 --> 41135158_bb00_046d_9f07_fa840a610429
  style 41135158_bb00_046d_9f07_fa840a610429 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

'use server';

import {setServerState} from './ServerState.js';

async function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

export async function like() {
  // Test loading state
  await sleep(1000);
  setServerState('Liked!');
  return new Promise((resolve, reject) => resolve('Liked'));
}

export async function greet(formData) {
  const name = formData.get('name') || 'you';
  setServerState('Hi ' + name);
  const file = formData.get('file');
  if (file) {
    return `Ok, ${name}, here is ${file.name}:
      ${(await file.text()).toUpperCase()}
    `;
  }
  return 'Hi ' + name + '!';
}

export async function increment(n) {
  // Test loading state
  await sleep(1000);
  return n + 1;
}

Domain

Subdomains

Frequently Asked Questions

What does actions.js do?
actions.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Entrypoint subdomain.
What functions are defined in actions.js?
actions.js defines 4 function(s): greet, increment, like, sleep.
What does actions.js depend on?
actions.js imports 2 module(s): ServerState.js, setServerState.
What files import actions.js?
actions.js is imported by 1 file(s): App.js.
Where is actions.js in the architecture?
actions.js is located at fixtures/flight/src/actions.js (domain: BabelCompiler, subdomain: Entrypoint, directory: fixtures/flight/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free