Coder Social home page Coder Social logo

Comments (4)

shawntabrizi avatar shawntabrizi commented on July 25, 2024 1

An empty render should return null:
https://stackoverflow.com/questions/42083181/is-it-possible-to-return-empty-in-react-render-function

Returning anything like false wont work as it expects some component and you get the error I posted.

from substrate-front-end-template.

JoshOrndorff avatar JoshOrndorff commented on July 25, 2024

Examples of how to do such a check https://github.com/substrate-developer-hub/substrate-ui-template/blob/8d01a81cf5c3f83def720259afd5468d0c35138e/src/App.jsx#L137-L141

from substrate-front-end-template.

shawntabrizi avatar shawntabrizi commented on July 25, 2024

An updated way to do this check is here:
37a0622

It keeps the check within the component itself, which is a pattern we should TOTALLY be following here.

Note the patch at the end of the conversation so that a failed check returns null

from substrate-front-end-template.

JoshOrndorff avatar JoshOrndorff commented on July 25, 2024

Agree, this is a good idea. What's the motivation for returning null? It otherwise would have returned false I think.

from substrate-front-end-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.