Questions tagged [codesandbox]

Codesandbox.io is an open-source online code editor supporting vanilla JS, Vue.js, Angular.js, React.js, and Preact.js. DO NOT use this tag just because your code is hosted on CodeSandbox, and your problem is otherwise unrelated to the CodeSandbox site.

276 questions
20
votes
2 answers

How to align console panel to right in codesandbox?

I'd like to align the browser/test/console panel to the right side of the js panel. First tried to drag them, but it didn't work. Is there any way?
15
votes
2 answers

How to configure ESLint / Prettier formatting rules on "codesandbox.io"

On codesandbox.io, how can I configure Prettier so that it doesn't change the line breaks? Also, how can I deactivate specific ESLint rules. For example, I would like to turn off the react-hooks/rules-of-hooks rule. A newly created eslintrc file…
Natasha
  • 516
  • 7
  • 24
11
votes
5 answers

react.js | how to get rid of cross-origin error in Codesandbox

IN FIREFOX: When I execute my code the typical error I should get is: "TypeError: Cannot read property 'setState' of undefined", instead I received a very weird cross-origin error. Here is a screenshot of the error: http://prntscr.com/iwipnb Error…
lito
  • 3,105
  • 11
  • 43
  • 71
10
votes
4 answers

styled-components is saying wrapped styled() around your React component (Component)

I have my app in CodeSandbox using styled-component. Please refer the below url https://lrn6vmq297.sse.codesandbox.io/ Everytime I made some changes, the console is saying. Warning: Prop `className` did not match. It looks like you've wrapped…
Danny Kim
  • 809
  • 1
  • 7
  • 15
9
votes
2 answers

How do I use Scss files in CodeSandbox?

I haven't used SASS or SCSS in anything besides codepen before so apologies if this is a basic question, but my CSS was working fine, but I wanted to nest some tags, and when I setup the SCSS and SASS dependencies and changed my filename to .scss,…
Cdhippen
  • 615
  • 1
  • 10
  • 32
7
votes
1 answer

Is there a way to use npm scripts in codesandbox.io?

I am trying to run json-server npm in codesandbox. I have created a vanilla project and added a dependency to the package.json. I have to run a script with json-server --watch db.json. Is there a way in codesandbox to run the script?
Shankar Ganesh Jayaraman
  • 1,401
  • 1
  • 16
  • 22
6
votes
0 answers

Enabling URL-based imports on codesandbox.io

I currently get the following error, when attempting to use a URL-based import on codesandbox.io: ESModules url imports are only supported in the experimental ESModule preset. In which configuration file does this preset reside?
Ben Aston
  • 53,718
  • 65
  • 205
  • 331
6
votes
1 answer

Why is a ReactJS component using Hooks rendered once or twice depending on developer console is open or not?

The following code prints out the same time twice inside the console of codesandbox.io website (that version uses StrictMode) and also in the snippet below (not using StrictMode): const { useState, useEffect } = React; function useCurrentTime()…
nonopolarity
  • 146,324
  • 131
  • 460
  • 740
6
votes
3 answers

CodeSandbox editor has stopped auto completing the corresponding JSX closing tags?

CodeSandbox editor used to auto generate the corresponding close tag for the current tag. For example:
// THEN IT WOULD AUTO GENERATE THE
TAG But don't know exactly when, it stopped doing that, and I have to write it manually. Is…
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
6
votes
4 answers

How to sync to codesandbox from github repo?

I created a CodeSandbox from github repo. How can I sync to CodeSandbox if there are some commits pushed to github repo? I see there is a github view on Codesandbox but it doesn't show any pull action.
Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523
5
votes
1 answer

Jest reports that test passes even though expect assertion fails

In this code sandbox the following test is executed: import { of } from "rxjs"; import { map } from "rxjs/operators"; const source = of("World"); test("It should fail", () => { source.subscribe(x =>…
Ole
  • 41,793
  • 59
  • 191
  • 359
4
votes
1 answer

react-dom installed, but not found. `Could not find module in path: 'react-dom/client' relative to`

Here is the Codesandbox I want to run a rest, but the Tests tab shows this error. Could not find module in path: 'react-dom/client' relative to '/node_modules/@testing-library/react/dist/@testing-library/react.esm.js' I referred to these but they…
Leonard
  • 2,978
  • 6
  • 21
  • 42
4
votes
3 answers

Codesandbox thumbnail configuration

I have some codesandboxes showing the default-sandbox-thumbnail and others showing the thumbnail of the codesandbox right. See the screenshot of my sandboxes list It is not clear to me from what is depending I have looked at the documentation to…
Koala7
  • 1,340
  • 7
  • 41
  • 83
4
votes
1 answer

Object.keys iteration causing Typescript error "Element implicitly has an 'any' type because index expression is not of type 'number'"

I am trying to display the results of an API call that returns an object. In order to do a .map, I used Object.keys so that it will display the results. I'm learning new to Typescript and attempting to practice in a personal project, but I'm stumped…
stonerose036
  • 241
  • 3
  • 14
4
votes
4 answers

CSS modules not working in Codesandbox - can't find files even though they exist

I'm trying to build a project and I just moved my code from VSCode to Codesandbox. I must mention that the code was working fine in VSC but for some reason it's not working in Codesandbox - the CSS modules can't be found. I am thinking I am maybe…
user4491949
1
2 3
18 19